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.1k
黒魔術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
300
フリルの商品を色で検索できるようにした話
shoby
5
4.1k
Search fashion items by colors
shoby
0
130
iOS 7をサポート対象外にして開発を健全化する
shoby
3
3.8k
Apple Watch Tips
shoby
0
3.8k
WWDC 2015で 発表された新機能と サービスへの活かし方
shoby
2
7.3k
Other Decks in Technology
See All in Technology
Developer Experienceを向上させる基盤づくりの取り組み事例集
coconala_engineer
0
150
内製化を目指す事業会社が、システム開発会社と共に進める「開発生産性改善」の取り組み事例 #devsumi
yuwji
0
100
開発者の定量・定性データを組み合わせて開発者体験を把握するための取り組み
ham0215
1
130
Next.js のページ遷移を全力で止める
ypresto
7
3.2k
OCI で始める!! Red Hat OpenShift / Get Started OpenShift on OCI
oracle4engineer
PRO
1
180
Envoy External AuthZとgRPC Extensionを利用した「頑張らない」Microservices認証認可基盤
andoshin11
0
250
テスト”ケース”駆動開発 で手戻りをなくそう
ryohma0510
0
320
なぜクラウドサービスで Web コンソールを提供するのか
shuta13
4
2k
フルカイテン株式会社 採用資料
fullkaiten
0
32k
サプライチェーン攻撃に備える
ryunen344
0
280
忙しい人のためのLangGraph概要まとめ
__ymgc__
1
190
プロダクトエンジニアを支えるための開発生産性向上施策
tsukakei
0
140
Featured
See All Featured
Infographics Made Easy
chrislema
239
18k
The Power of CSS Pseudo Elements
geoffreycrofte
71
5.3k
The Cult of Friendly URLs
andyhume
76
6k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
45
4.8k
Raft: Consensus for Rubyists
vanstee
135
6.5k
A better future with KSS
kneath
235
17k
Into the Great Unknown - MozCon
thekraken
29
1.4k
How to Ace a Technical Interview
jacobian
274
23k
What’s in a name? Adding method to the madness
productmarketing
PRO
21
3k
Design by the Numbers
sachag
277
19k
GitHub's CSS Performance
jonrohan
1030
450k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
26
1.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/
͓͠·͍