How to show it.Tech.Yuichi YoshidaResearcher, DENSO IT Laboratory, Inc.#????@sonson_twit© 2014 DENSO IT Laboratory, Inc., All rights reserved. Redistribution or public display not permitted without written permission from DENSO IT Laboratory, Inc.First step of 3D touch
View Slide
ࣗݾհ• sonson• twitter: sonson_twit• github: sonsongithub• portfolio• reddift(SwiftͰॻ͍ͨreddit.comͷAPIϥούʔ)• ࣄ• ը૾ೝࣝ/ݕࡧ/ͦΕΛͬͨΞϓϦ• ػցֶशͷ͓ษڧͱ͔ॾʑͱ͔
͜ͷϘέͳ͍ྖҬͷઃఆʙμϝͳྫ
͜ͷϘέͳ͍ྖҬͷઃఆʙOK
͜ͷϘέͳ͍ྖҬͷઃఆʙҰ൪͍͍
දࣔͷྲྀΕ• registerForPreviewingͰ४උ͢Δ• ͜͜Ͱ3D touchʹԠ͢ΔviewΛઃఆ͢Δ• previewingContext(_:viewControllerForLocation:)• sourceRectΛઃఆ͢Δ• ্Ͱઃఆͨ͠viewͷ࠲ඪܥͰsourceRectΛηοτ
registerForPreviewing
previewingContext(_:viewControllerForLocation:)• Body
previewingContext(_:viewControllerForLocation:)6*7JFX$POUSPMMFS1SFWJFXJOH%FMFHBUF6*7JFX$POUSPMMFS 7JFX
previewingContext(_:viewControllerForLocation:)6*7JFX$POUSPMMFS1SFWJFXJOH%FMFHBUF6*7JFX$POUSPMMFS 7JFX%UPVDIൃੜ
previewingContext(_:viewControllerForLocation:)6*7JFX$POUSPMMFS1SFWJFXJOH%FMFHBUF6*7JFX$POUSPMMFS 7JFXͳΜ͔ίϯςϯπ͋Δʁίϯςϯπ
previewingContext(_:viewControllerForLocation:)6*7JFX$POUSPMMFS1SFWJFXJOH%FMFHBUF6*7JFX$POUSPMMFS 7JFX6*7JFX$POUSPMMFS͜ͷྖҬ͔Β͜ͷ7JFX$POUSPMMFSΛදࣔͯ͠ίϯςϯπ
previewingContext(_:viewControllerForLocation:)
UIView.convert• ͋Δview͔Βݟͨɼ͋ΔviewͷrectΛܭࢉͯ͘͠ΕΔ• a.convert(rect:, to:b)• view aͷrectΛview b͔Βݟͨrectʹม• a.convert(rect:, from:b)• view bͷrectΛview a͔Βݟͨrectʹม• ͋Γ·͢• a.convert(point: to:b)• a.convert(point: from:b)
UIView.convertf=(200,50,50,60)bac
UIView.convertf=(200,50,50,60)baa.convert(f, from:c) => (800,80,50,60)c
UIView.convertf=(200,50,50,60)bac.convert(f, to:a) => (800,80,50,60)c
Ԡ༻͢Δͱ
αϯϓϧ• UZTextView• https://github.com/sonsongithub/UZTextView• developϒϥϯν
3D Touchͷςετ• ࣮ػ• Simulator
·ͱΊ• registerForPreviewingͰ४උ• viewΛొ• previewingContext(_:viewControllerForLocation:)• view controllerΛ࡞• Ξχϝʔγϣϯ͍ͤͨ͞ྖҬΛܭࢉ• ฦ͢