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
(iOS13の)UIBarButtonItem 位置調整あるある
Search
domonr
October 23, 2019
Programming
0
980
(iOS13の)UIBarButtonItem 位置調整あるある
domonr
October 23, 2019
Tweet
Share
More Decks by domonr
See All by domonr
アプリのリニューアル時にDomainModelを削除した話(設計カンファレンス extends OOC 2024.3.29)
domonr
0
620
あるあるLT~文字列共通化~
domonr
0
570
あるあるLT_domonr_2019-03-19.pdf
domonr
0
1.4k
脱ぼっちレビュー_domonr
domonr
0
330
Other Decks in Programming
See All in Programming
快速入門可觀測性
blueswen
0
450
Jakarta EE meets AI
ivargrimstad
0
340
Scalaから始めるOpenFeature入門 / Scalaわいわい勉強会 #4
arthur1
1
360
20241217 競争力強化とビジネス価値創出への挑戦:モノタロウのシステムモダナイズ、開発組織の進化と今後の展望
monotaro
PRO
0
130
歴史と現在から考えるスケーラブルなソフトウェア開発のプラクティス
i10416
0
160
開発者とQAの越境で自動テストが増える開発プロセスを実現する
92thunder
1
210
「とりあえず動く」コードはよい、「読みやすい」コードはもっとよい / Code that 'just works' is good, but code that is 'readable' is even better.
mkmk884
5
1.2k
なまけものオバケたち -PHP 8.4 に入った新機能の紹介-
tanakahisateru
1
130
Fibonacci Function Gallery - Part 1
philipschwarz
PRO
0
260
Amazon S3 NYJavaSIG 2024-12-12
sullis
0
110
Online-Dokumentation, die hilft: Strukturen, Prozesse, Tools
ahus1
0
100
Beyond ORM
77web
10
1.4k
Featured
See All Featured
Building a Scalable Design System with Sketch
lauravandoore
460
33k
Six Lessons from altMBA
skipperchong
27
3.5k
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
507
140k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
33
2k
Rails Girls Zürich Keynote
gr2m
94
13k
Making the Leap to Tech Lead
cromwellryan
133
9k
YesSQL, Process and Tooling at Scale
rocio
170
14k
Gamification - CAS2011
davidbonilla
80
5.1k
Build The Right Thing And Hit Your Dates
maggiecrowley
33
2.4k
How to Ace a Technical Interview
jacobian
276
23k
The Art of Programming - Codeland 2020
erikaheidi
53
13k
Bash Introduction
62gerente
609
210k
Transcript
(iOS13ͷ)UIBarButtonItem Ґஔௐ͋Δ͋Δ ͲΜ/2019/10/23 1
ͲΜ EPNPOS wJ04͙Β͍ͬͯ·͢ wϚϯΨ͖Ͱ͢ ɹ࠷͔ۙΒ͘ΓαʔΧεಡΈ·ͨ͠ 2
(iOS13ͷ) UIBarButtonItem Ґஔௐ͋Δ͋Δ 3
(iOS13Ͱ)UIBarButtonItemͷ ҐஔΛ(OSඪ४ΑΓ)֎ଆʹ͍ͨ͠ 4 σβΠφʔ ͬͯݴΘΕͨΓ͠·͢ΑͶ
5 6pt (OSඪ४8pt or 16pt)
ͳͷͰࠓiOS13ରԠߟྀͨ͠ UIBarButtonItemͷஔʹ͍ͭͯ ൃද͠·͢ 6
UINavigationBarपΓͷ֊ͷઆ໌ 7
8
9 • UINavigationBar ͷ্ʹ UIBarButtonItem ͕ઃஔ͞Ε͍ͯΔܗ • λοϓྖҬҐஔௐ ؆୯
10
11 • UINavigationBar ͷ্ʹUIStackView ͕ஔ͔Εͦͷதʹ UIBarButtonItem ͕ઃஔ͞Ε͍ͯΔܗ • λοϓྖҬҐஔௐ Λ͢Δࡍʹ
UIStackView͕अຐ
12
13 • UINavigationBar ͷ্ʹUIStackView ͕ஔ͔Εͦͷதʹ UIBarButtonItem ͕ઃஔ͞Ε͍ͯΔܗ • ͞ΒʹUIStackView ͕Ṗͷprivate
classʹ ͳ͍ͬͯΔ….
14
֊ΛݟͨΒΘ͔ΔͷͰ͕͢ɺ iOS11͔ΒiOS13ʹ͔͚ͯجຊత ʹมԽ͋Γ·ͤΜɻ 15 ͨͩ͠…
Client error attempting to change layout margins of a private
view 16 ϓϥΠϕʔτϏϡʔͷϨΠΞτϚʔδϯΛมߋ͠ Α͏ͱ͢ΔΫϥΠΞϯτΤϥʔ
Client error attempting to change layout margins of a private
viewͷઆ໌ 17
18 loop: for view in subviews { for stack in
view.subviews where stack is UIStackView { stack.superview?.layoutMargins = .zero break loop } } ্هͷΑ͏ʹSubViewΛճͯ͠layoutMarginsΛௐͨ͠ΒౖΒΕ·͢
ͳͷͰɺiOS13Ҏ߱NavigationBar ্ͷUIStackViewʹରͯ͠ૢ࡞Λ ߦ͏͜ͱ͕Ͱ͖ͳ͘ͳΓ·ͨ͠ 19
20
iOS13Ҏ߱ͷରԠํ๏ 21
͖͞ʹݴ͏ͱ…. iOS12·Ͱprivate viewΛૢ࡞Ͱ͖ͨͷͰɺ ֎ଆ0pt·ͰλοϓൣғΛ૿ͤ·͕ͨ͠ɺ iOS13Ҏ߱ແཧͰͨ͠ 22
23 UIBarButtonItem(barButtonSystemItem: .fixedSpace, target: nil, action: nil)
StackViewͷ࠷ॳͷཁૉΛ UIBarButtonItem(customView: view) Ͱͳ͘ UIBarButtonItem(barButtonSystemIte m: .fixedSpace, target: nil, action:
nil) ʹ͢Δͱ֎ଆ͔ΒͷҐஔ͕8ptʹͳΔ 24
25 8pt
ͪͳΈʹStackViewͷ࠷ॳͷཁૉΛ UIBarButtonItem(customView: view) ʹ͢Δͱ֎ଆ͔ΒͷҐஔ͕16ptʹͳΔ (customViewҎ֎ͷཁૉΛ࠷ॳʹೖΕΕ8ptʹͳΔΒ͍͠) 26
27 class HogeViewController: UIViewController { override func viewDidLoad() { super.viewDidLoad()
self.navigationItem.leftBarleftButtonItems = [ UIBarButtonItem(barButtonSystemItem: .fixedSpace, target: nil, action: nil), UIBarButtonItem(customView: view) ] } }
• iOS13Ҏ߱8ptΑΓ֎ଆʹButtonΛஔ͢Δͷແཧ • UIBarButtonItem(customView:)Λී௨ʹೖΕΔͱ֎ଆ͔Β16ptͷ ҐஔʹͳΔ • UIBarButtonItem(customView:)Ҏ֎ͷ UIBarButtonItem(barButtonSystemItem:)Λ࠷ॳʹೖΕΔͱ8ptʹ ͳΔ •
ΊΜͲ͍͘͞ͷͰUINavigationBarΛΘͳ͍΄͏͕ૣ͍͔ 28 ·ͱΊ
iOS13ͰNavigationBarButtonͷҐஔΛௐ͍ͨ͠ - Qiita https://qiita.com/rd0501/items/8e8254a23d87a9b2fea2 29 ࢀߟ
͓ΘΓ 30