Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
黒魔術AutoLayoutとiPhone 6/6 Plus
Search
shoby
October 03, 2014
Technology
13
4.2k
黒魔術AutoLayoutとiPhone 6/6 Plus
iOS 8 & iPhone6/6 Plus 開発知見共有会での発表資料です。
shoby
October 03, 2014
Tweet
Share
More Decks by shoby
See All by shoby
フリルのCMを支える分析 (メディアバイイング編)
shoby
0
400
FirebaseとBigQueryによるアプリのKPI分析(CMの効果検証編)
shoby
2
2.4k
ユーザーに受け入れられ、問題を起こしづらい大規模リニューアルの進め方
shoby
60
13k
ReactiveCocoaで作る快適な登録フォーム
shoby
0
310
フリルの商品を色で検索できるようにした話
shoby
5
4.2k
Search fashion items by colors
shoby
0
140
iOS 7をサポート対象外にして開発を健全化する
shoby
3
3.8k
Apple Watch Tips
shoby
0
3.9k
WWDC 2015で 発表された新機能と サービスへの活かし方
shoby
2
7.3k
Other Decks in Technology
See All in Technology
障害対応指揮の意思決定と情報共有における価値観 / Waroom Meetup #2
arthur1
5
470
100 名超が参加した日経グループ横断の競技型 AWS 学習イベント「Nikkei Group AWS GameDay」の紹介/mediajaws202411
nikkei_engineer_recruiting
1
170
【Startup CTO of the Year 2024 / Audience Award】アセンド取締役CTO 丹羽健
niwatakeru
0
980
Taming you application's environments
salaboy
0
180
IBC 2024 動画技術関連レポート / IBC 2024 Report
cyberagentdevelopers
PRO
0
110
rootlessコンテナのすゝめ - 研究室サーバーでもできる安全なコンテナ管理
kitsuya0828
3
380
第1回 国土交通省 データコンペ参加者向け勉強会③- Snowflake x estie編 -
estie
0
130
Lexical Analysis
shigashiyama
1
150
Incident Response Practices: Waroom's Features and Future Challenges
rrreeeyyy
0
160
B2B SaaSから見た最近のC#/.NETの進化
sansantech
PRO
0
750
Exadata Database Service on Dedicated Infrastructure(ExaDB-D) UI スクリーン・キャプチャ集
oracle4engineer
PRO
2
3.2k
Adopting Jetpack Compose in Your Existing Project - GDG DevFest Bangkok 2024
akexorcist
0
110
Featured
See All Featured
For a Future-Friendly Web
brad_frost
175
9.4k
Gamification - CAS2011
davidbonilla
80
5k
What’s in a name? Adding method to the madness
productmarketing
PRO
22
3.1k
Making Projects Easy
brettharned
115
5.9k
How To Stay Up To Date on Web Technology
chriscoyier
788
250k
How GitHub (no longer) Works
holman
310
140k
Fantastic passwords and where to find them - at NoRuKo
philnash
50
2.9k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
250
21k
How to Ace a Technical Interview
jacobian
276
23k
Embracing the Ebb and Flow
colly
84
4.5k
Learning to Love Humans: Emotional Interface Design
aarron
273
40k
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
29
2.3k
Transcript
ࠇຐज़"VUP-BZPVUͱ J1IPOF1MVT @shobyshoby
ࣗݾհ pixivͰΞϓϦͭͬͯ͘·͢
ຊ
iOS 7 ࣌
Before
After
Storyboard͕ഁͨ͠ͷͰ ཧͯ͠AutoLayoutԽͨ͠ ৄࡉʮStoryboard + AutoLayoutόουϊϋʯͷεϥΠυ https://speakerdeck.com/shoby/storyboard-plus-autolayout-bad-knowhow
iOS 8
ʮXcode Beta 6 Ͱ͏·͘ಈ͍ͯΔ͠ɺ iOS 8 ָউͬ͢Θʔ ը໘େ͖͘ͳΔͬͯᷚ͋Δ͚Ͳɺ AutoLayoutରԠͯ͠Δ͠ɺ༨༟ͬ͠ΐʯ
iPhone 6/6 Plus ൃද
͏Θ͋͋͋͋
ࠇຐज़"VUP-BZPVUͱ J1IPOF1MVT
ը໘αΠζมߋͷରԠ͕ ͭΒ͔ͬͨ෦Λڞ༗͠·͢ ! Α͘ߟ͓͑ͯ͏ AutoLayout
֓ཁ
"VUP-BZPVUΞχϝʔγϣϯ "VUP-BZPVU 6*4DSPMM7JFX "VUP-BZPVUͷϝϯςφϯείετ
"VUP-BZPVU Ξχϝʔγϣϯ
AutoLayoutΞχϝʔγϣϯ "VUP-BZPVUͷ$POTUSBJOUΛ *#0VUMFUͰଓ $POTUSBJOUΛ6*7JFXͷ BOJNBUJPO#MPDLதͰมԽͤ͞Δ
Ξχϝʔγϣϯ
Ξχϝʔγϣϯͷίʔυ [UIView animateWithDuration:duration animations:^{ self.detailViewTopConstraint.constant = height; [self.view layoutIfNeeded]; }];
ϝϦοτ ίʔυྔ͕ݮΔ ୯Ұͷ7JFX͚ͩͳΒγϯϓϧ Ͱ͔Γ͍͢
σϝϦοτ ґଘؔΛ࣋ͬͨ7JFX͕ෳಉ࣌ʹมԽ͠ ͯ͠·͏ ґଘؔͷ͋Δผ7JFXͷϢʔβʔૢ࡞͕ ݪҼͰαΠζ͕มΘΔ͜ͱʜ BOJNBUJPO#MPDL֎ͰϨΠΞτͷ࠶ߏ ͕ߦΘΕΔͱΞχϝʔγϣϯ͠ͳ͍
"VUP-BZPVU 6*4DSPMM7JFX
6*4DSPMM7JFXͷϝϦοτɾ σϝϦοτ .JYFE"QQSPBDIͱ1VSF "VUP-BZPVU"QQSPBDI ԣ෯ґଘίʔυ
UIScrollViewͷ ϝϦοτɾσϝϦοτ
UIScrollView AutoLayoutʹ͍ͯͳ͍
ཧ༝͕ແ͚Ε UIPageViewController UICollectionViewΛΘΓʹ ͏ࣄΛߟ͑ͨํ͕ྑ͍
UIScrollViewͷϝϦοτ εΫϩʔϧɺϖʔδϯάɺζʔ ϜΛ݉Ͷඋ͑ͨଟػೳੑ εΫϩʔϧঢ়گʹ߹Θͤͨ ࡉ͔͍ϑΟʔυόοΫ͕Մೳ
UIScrollViewͷσϝϦοτ 6*4DSPMM7JFXͷ֎෦ͱ෦ͷ࠲ඪͷ Έ͕ҟͳΔͨΊɺ"VUP-BZPVU ʹΑͬͯԿ͕ى͔ͨ͜ཧղͮ͠Β͍ ෦ͷίϯςϯπΛಈతʹมԽͤ͞ Δ͜ͱ͕ଟ͘ɺ੩తʹ੍ΛՃ͢ Δ"VUP-BZPVUͱ૬ੑ͕ѱ͍
UIScrollViewͷ༻్ ଟ͘ͷใͷҰ෦ΛݟͤΔʢεΫϩʔϧʣ จ຺ಉ͚ͩ͡ͲɺͦΕͧΕҧ͏ίϯςϯ πΛͭͭݟͤΔʢϖʔδϯάʣ ͭͷڊେͳίϯςϯπͷҰ෦ΛݟͤΔ ʢζʔϜʣ
UIScrollViewͷସ ଟ͘ͷใͷҰ෦ΛݟͤΔʢεΫϩʔϧʣ ˠ6*5BCMF7JFXɺ6*$PMMFDUJPO7JFX จ຺ಉ͚ͩ͡ͲɺͦΕͧΕҧ͏ίϯςϯπΛͭ ͭݟͤΔʢϖʔδϯάʣ ˠ6*1BHF7JFX$POUSPMMFSɺ6*$PMMFDUJPO7JFX ͭͷڊେͳίϯςϯπͷҰ෦ΛݟͤΔʢζʔϜʣ ˠ͖͋ΒΊͯ6*4DSPMM7JFX͓͏ʜ
pixivΞϓϦͷ߹ ΠϥετӾཡͷͨΊͷ շదੑΛٻͨ݁͠Ռɺ UIScrollViewΛ͍ଓ͚͍ͯΔ
Mixed Approachͱ Pure Auto Layout Approach
UIScrollView And Autolayout https://developer.apple.com/library/ios/technotes/tn2154/_index.html ͍߹Θ͕ͤଟ͔ͬͨͷ͔ UIScrollViewˍAutoLayoutͷ ઐ༻υΩϡϝϯτ͕͋Δ
Mixed Approach TDSPMM7JFXͷ֎ଆʹ੍ TDSPMM7JFXͷDPOUFOU4J[FखಈͰઃఆ DPOUFOU7JFXBVUPSFTJ[JOH.BTL DPOUFOU7JFXΛಈతʹՃআͨ͠Γɺ ෳͷDPOUFOU7JFXΛѻ͏߹ͬͪ͜
Pure Auto Layout Approach TDSPMM7JFXͷ֎ଆͱɺதʹ੍ TDSPMM7JFXͷDPOUFOU4J[F੍ʹΑΓܾ ·ͬͨDPOUFOU7JFXͷαΠζʹͳΔ DPOUFOU7JFXͷαΠζɺTDSPMM7JFXͱ ֎ଆͱWJFXͷ੍ʴDPOUFOU7JFXͱ TDSPMM7JFXͱͷ੍ͷෳ߹݅Ͱܾ·Δͨ
ΊɺཧղࠔΛۃΊΔ
contentView scrollView contentView scrollView Mixed Approach Pure Auto Layout Approach
UIScrollViewͱ ԣ෯ґଘίʔυ
UIScrollViewͰ ԣํʹϖʔδϯά͢Δͱ σόΠεͷԣ෯ґଘʹͳΔ
Mixed Approachͷ߹ɺ contentViewੜޙ scrollViewͷԣ෯͕มΘΔͱ ද่͕ࣔΕΔ
2 1 3 4 pixivΞϓϦͷߏ
2 1 3 4 CGFloat offset = 2 * self.scrollView.frame.size.width;
self.scrollView.contentOffset = CGPointMake(offset, 0); 2ϖʔδʹඈͿͱ͖
2 1 3 4 scrollViewͷԣ෯͕มΘΔ CGFloat offset = 2 *
self.scrollView.frame.size.width; self.scrollView.contentOffset = CGPointMake(offset, 0);
ԣ෯ґଘίʔυͷղܾࡦ WJFXͷԣ෯͕มΘΔʹશͯ ͷDPOUFOU7JFXͷGSBNFΛܭ ࢉ͢͠ ԣ෯ґଘͷॲཧͷલʹɺ MBZPVU*G/FFEFEΛݺͼग़͢
"VUP-BZPVUͷ ϝϯςφϯείετ
AutoLayout ਓྨʹૣ͗ͨ͢…
ಡΊΔAutoLayout ίʔυଆͰ"VUP-BZPVUΛॻ ͘ͱϝϯςφϯεੑ͕ߴ͍ όʔδϣϯཧ͕Ͱ͖Δʂ ଞਓͷ੍͕ಡΊΔʂ
·ͱΊ
৽͍͠Ͱͷಈ࡞֬ೝɺൃද͞Εͨ ޙ͡Όͳ͍ͱ͍͠ "VUP-BZPVUΛͬͯΞχϝʔγϣϯΛ ͢Δͱίʔυ؆ܿʹͳΔ͕ɺґଘ͕ଟ ͍ͱෳࡶ 6*4DSPMM7JFX"VUP-BZPVUͩͱͭΒ͍ ίʔυଆͰ੍Λॻ͘ͱϝϯςφϯεͰ͖ Δ
http://recruit.pixiv.net/
͓͠·͍