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
830
(iOS13の)UIBarButtonItem 位置調整あるある
domonr
October 23, 2019
Tweet
Share
More Decks by domonr
See All by domonr
アプリのリニューアル時にDomainModelを削除した話(設計カンファレンス extends OOC 2024.3.29)
domonr
0
340
あるある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
Rails と人魚の話/rails-and-mermaid
sanfrecce_osaka
0
100
From Spring Boot 2 to Spring Boot 3 with Java 21 and Jakarta EE
ivargrimstad
0
1.2k
Netty Chicago Java User Group 2024-04-17
sullis
0
140
코틀린으로 멀티플랫폼 만들기
pangmoo
0
120
ゆるい個人開発のススメ
kuroppe1819
10
950
DMMプラットフォームがTiDB Cloudを採用した背景
pospome
8
3.7k
脱・初心者!脱・マネコン!AWS CDKを使ってみませんか!?
har1101
0
300
スクラムガイドのスプリントレトロスペクティブを改めて読みかえしてみた / Re-reading the Sprint Retrospective Section in the Scrum Guide
mackey0225
3
330
オブジェクト指向のリ・オリエンテーション~歴史を振り返り、AI時代に向きなおる~
hanyudaeiiti
10
5.7k
エンターテイメント業界で利用されるAWS
demuyan
0
200
PHPの次期バージョンはこの時期どうなっているのか - Internalsの開発体制について - PHPカンファレンス小田原
youkidearitai
PRO
1
180
1인 개발자로 행복하게 살기 - GDG 송도 헬로월드 2024
benjaminkim
1
5.6k
Featured
See All Featured
The Pragmatic Product Professional
lauravandoore
24
5.8k
In The Pink: A Labor of Love
frogandcode
138
21k
4 Signs Your Business is Dying
shpigford
175
21k
From Idea to $5000 a Month in 5 Months
shpigford
377
45k
GraphQLとの向き合い方2022年版
quramy
31
12k
Documentation Writing (for coders)
carmenintech
59
3.9k
Reflections from 52 weeks, 52 projects
jeffersonlam
344
19k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
243
20k
Building an army of robots
kneath
300
41k
Code Reviewing Like a Champion
maltzj
513
39k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
115
18k
KATA
mclloyd
14
12k
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