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
840
(iOS13の)UIBarButtonItem 位置調整あるある
domonr
October 23, 2019
Tweet
Share
More Decks by domonr
See All by domonr
アプリのリニューアル時にDomainModelを削除した話(設計カンファレンス extends OOC 2024.3.29)
domonr
0
370
あるあるLT~文字列共通化~
domonr
0
520
あるあるLT_domonr_2019-03-19.pdf
domonr
0
1.2k
脱ぼっちレビュー_domonr
domonr
0
260
Other Decks in Programming
See All in Programming
Implementing Design Systems in Swift
seyfoyun
2
500
ペパボOpenTelemetry革命
pyama86
2
180
Deep Dive into React Stream/Serialize
mugi_uno
3
760
Fast JSX: Don't clone props object #28768
yossydev
1
220
Webアプリをできるだけコードを手書きしないで作ってみる
tomokusaba
2
210
CREってこういうこと? 体験入社 - 提案資料 - / what-is-cre-trial-employment
shinden
1
580
仕様と実装で学ぶOpenTelemetry
drumato
1
150
Fragment Composition of GraphQL
quramy
13
1.6k
Balkan Ruby 2024 — How and why to run SQLite on Rails in production
fractaledmind
0
110
Timeline エディター拡張入門
yucchiy
0
370
Powerfully Typed TypeScript
euxn23
1
420
JavaScript Closure
asoluka
0
1.5k
Featured
See All Featured
GitHub's CSS Performance
jonrohan
1025
450k
Bash Introduction
62gerente
605
210k
What’s in a name? Adding method to the madness
productmarketing
PRO
17
2.7k
Intergalactic Javascript Robots from Outer Space
tanoku
266
26k
Pencils Down: Stop Designing & Start Developing
hursman
117
11k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
0
56
A better future with KSS
kneath
231
16k
Done Done
chrislema
178
15k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
34
8.9k
[RailsConf 2023] Rails as a piece of cake
palkan
28
4k
Building Your Own Lightsaber
phodgson
100
5.7k
Designing with Data
zakiwarfel
96
4.8k
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