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
930
(iOS13の)UIBarButtonItem 位置調整あるある
domonr
October 23, 2019
Tweet
Share
More Decks by domonr
See All by domonr
アプリのリニューアル時にDomainModelを削除した話(設計カンファレンス extends OOC 2024.3.29)
domonr
0
490
あるあるLT~文字列共通化~
domonr
0
550
あるあるLT_domonr_2019-03-19.pdf
domonr
0
1.3k
脱ぼっちレビュー_domonr
domonr
0
310
Other Decks in Programming
See All in Programming
tsconfig.jsonの最近の新機能 ファイルパス編
uhyo
6
1.5k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
7
280
Vue :: Better Testing 2024
up1
1
390
全方位強化 Python 服務可觀測性:以 FastAPI 和 Grafana Stack 為例
blueswen
1
380
文化が生産性を作る
jimpei
3
540
DevFest Android in Korea 2024 - 안드로이드의 문단속 : 앱을 지키는 암호화 이야기
mdb1217
1
140
CSC305 Lecture 01
javiergs
PRO
1
150
Modern Functional Fluent CFML REST by Luis Majano
ortus24
0
140
Compose Multiplatform과 Ktor로 플랫폼의 경계를 넘어보자
kwakeuijin
0
250
Infrastructure as Code でセキュリティを楽にしよう!
konokenj
6
1.4k
"noncopyable types" の使いどころについて考えてみた
andpad
0
140
pytest プラグインを開発して DRY に自動テストを書こう
inuatsu
2
250
Featured
See All Featured
How to train your dragon (web standard)
notwaldorf
87
5.6k
Git: the NoSQL Database
bkeepers
PRO
425
64k
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
3
220
Debugging Ruby Performance
tmm1
73
12k
The Invisible Side of Design
smashingmag
297
50k
The World Runs on Bad Software
bkeepers
PRO
65
11k
A Tale of Four Properties
chriscoyier
156
22k
[RailsConf 2023] Rails as a piece of cake
palkan
49
4.7k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
327
21k
How to name files
jennybc
77
99k
How to Think Like a Performance Engineer
csswizardry
16
1k
The Illustrated Children's Guide to Kubernetes
chrisshort
48
48k
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