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
そのAlertController 回転ロックできないってよ
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
tamappe
February 12, 2020
Technology
770
1
Share
そのAlertController 回転ロックできないってよ
tamappe
February 12, 2020
More Decks by tamappe
See All by tamappe
async/awaitの性能をDartとSwiftとの比較で読み解く
tamappe
2
1.9k
商業雑誌に技術記事を寄稿した振り返り
tamappe
3
1.7k
リモートワークでBitriseを導入したときにハマりにハマった話
tamappe
0
330
SwiftUIとFlutterを比較する
tamappe
1
1.5k
レアジョブアプリでのアクセス負荷で生じたAPI遅延問題を アプリエンジニア視点で対策を考えてみる
tamappe
0
600
Fat Storyboardをリファクタリングしてみた
tamappe
0
370
Swift4.2で追加されたDynamic Member Lookupを使ってみよう
tamappe
0
950
Other Decks in Technology
See All in Technology
Cloud Run のアップデート 触ってみる&紹介
gre212
0
210
eBPF Can Do It! A 5-Minute Tour of 5 Real-World PHP Issues Solved with eBPF
egmc
0
320
コードレビューを制するチームがソフトウェアデリバリーのフローを制す / Beyond Code Review: Distributing Its Responsibilities Across the SDLC
mtx2s
1
220
OpenID Connectによるサービス間連携
takesection
0
130
ルールやカスタム機能、どう使う?理想の出力を引き出すために今知りたいIBM Bob 5つの機能
muehara
0
110
食べログのサーキットブレーカー導入を振り返って
atpons
1
150
Claude Codeですべての日常業務を爆速化しよう!
minorun365
PRO
16
15k
GitHub Copilot のこれまでとこれから: From Copilot to Collaborative Agents
yuriemori
1
230
NFLコンペ2026 解法
lycorptech_jp
PRO
0
120
layerx-fde-practices
cipepser
6
2.8k
データ分析基盤の信頼を支える視点と設計
yuki_saito
2
750
ビジュアルプログラミングIoTLT vol.23
1ftseabass
PRO
0
150
Featured
See All Featured
HU Berlin: Industrial-Strength Natural Language Processing with spaCy and Prodigy
inesmontani
PRO
0
390
<Decoding/> the Language of Devs - We Love SEO 2024
nikkihalliwell
1
230
Groundhog Day: Seeking Process in Gaming for Health
codingconduct
0
190
New Earth Scene 8
popppiees
3
2.3k
Why Mistakes Are the Best Teachers: Turning Failure into a Pathway for Growth
auna
0
150
Producing Creativity
orderedlist
PRO
348
40k
The Power of CSS Pseudo Elements
geoffreycrofte
82
6.3k
Public Speaking Without Barfing On Your Shoes - THAT 2023
reverentgeek
1
400
We Analyzed 250 Million AI Search Results: Here's What I Found
joshbly
1
1.3k
How People are Using Generative and Agentic AI to Supercharge Their Products, Projects, Services and Value Streams Today
helenjbeal
1
190
エンジニアに許された特別な時間の終わり
watany
107
240k
More Than Pixels: Becoming A User Experience Designer
marktimemedia
3
420
Transcript
ͦͷAlertController ճసϩοΫͰ͖ͳ͍ͬͯΑ @tamapppe potatotips #68 (iOS/Android։ൃTipsڞ༗ձ) 2020/2/12
I N T R O D U C T I
O N Tamappe (ͨ·ͬ) ϞόΠϧΞϓϦΤϯδχΞ 2014-20193݄·ͰϑϦʔϥϯεͱͯ͠׆ಈ 20194݄ΑΓϨΞδϣϒʹϞόΠϧΞϓϦΤϯδχΞͱͯ͠ೖࣾ झຯ: ήʔϜ(Splatoon2)ɺےτϨɺྉཧ Twitter: https://twitter.com/tamapppe 01
None
02
ຊͷςʔϚ iOSͷը໘ճస੍ޚ
͓͢͠Δ͜ͱ 03 - ճసͷ࣌ͷճస੍ޚ - ViewControllerͷ֊ - ճసϩοΫ (͜͜ͰճసͰ͖ͳ͍Α͏ʹ͢Δ͜ ͱ)
࠷ॳʹΫΠζ 04 ͜ͷUIViewControllerͷճసϩοΫͲ͜Ͱ੍ޚ͢Ε͍͍ʁ UITabBarController ʹ͍ͬͯΔ UINavigationController ʹ͍ͬͯΔ UIViewController ʹ͍ͬͯΔ presentViewController
ʹ͍ͬͯΔ UIAlertController (Ξϥʔτ) ͜ͷΞϥʔτ͕දࣔ͞Ε͍ͯΔ࣌ͷΈը໘͕ճస͞Εͳ͍Α͏ʹ͍ͨ͠ Ͳ͜Ͱ੍ޚ͢Ε͍͍ʁ ͜ΕΛղ͘ͷ͕ࠓճͷLTͷςʔϚͰ͢ɻ
← ͜ͷΞϥʔτ
Ͳͩ͜ͱࢥ͍·͔͢ʁ 05 1. UITabBarController 2. UINavigationController 3. UIViewController 4. presentViewController
5. UIAlertController
͕͠ผʹͳΓ·͕͢… ͷճసΛڐՄ͢Δํ๏Λ෮श͠·͢ 06 - Device Orientation - info.plist - ͦΕͧΕͷUIViewController
Ϋϥε
Device Orientation
Info.plist
info.plist 07 iPhoneͱiPadͱͰผʑʹཧ͍ͨ͠߹ʹΑ͍͘·͢ɻ - iPadճసͤ͞ͳ͍͚ͲɺiPhone͚ͩճస͍ͤͨ͞ - iPhoneͰճసͤͣ͞ʹiPad͚ͩճస͍ͤͨ͞ - iPhoneॎͷΈɺiPadԣը໘͚ͩ ͜Μͳ߹ʹΘΕ·͢ɻ
ͨͩ͠ɺ͜ΕશͯͷUIViewController ʹҰׅద༻ͤ͞Δͱ͖ͷΈ
ͦΕͧΕͷUIViewController Ͱ੍ޚ 08 Aը໘Ͱॎը໘ʹݻఆͯ͠ɺBը໘Ͱԣը໘͚ͩʹ͍ͨ͠ͳͲ UIViewController ୯ҐͰը໘ͷճసΛ੍ޚ͢Δ࣌ʹ͍·͢ɻ extension BaseNavigationController { //
ը໘Λճసͤ͞Δ͔Ͳ͏͔ override var shouldAutorotate: Bool { return true } // ճసํͷࢦఆ override var supportedInterfaceOrientations: UIInterfaceOrientationMask { return .all } }
ͬͱຊͰ͢ 09 ͜ͷUIViewControllerͷճసϩοΫͲ͜Ͱ੍ޚ͢Ε͍͍ʁ UITabBarController ʹ͍ͬͯΔ UINavigationController ʹ͍ͬͯΔ UIViewController ʹ͍ͬͯΔ presentViewController
ʹ͍ͬͯΔ UIAlertController (Ξϥʔτ)
͑ 10 ͜ͷUIViewControllerͷճసϩοΫͲ͜Ͱ੍ޚ͢Ε͍͍ʁ UITabBarController ʹ͍ͬͯΔ UINavigationController ʹ͍ͬͯΔ UIViewController ʹ͍ͬͯΔ presentViewController
ʹ͍ͬͯΔ UIAlertController (Ξϥʔτ) ( <- ίί) Answer) UIAlertController
͑ (ίʔυ) 11 UIAlertController+Orientation.swift import UIKit extension UIAlertController { open
override var shouldAutorotate: Bool { return false } open override var supportedInterfaceOrientations: UIInterfaceOrientationMask { return .portrait } }
ͦΕͧΕͷViewController Ͱ੍ޚ͢Δ߹ 12 UIAlertController → UIAlertController presentViewController →UINavigaitonController UITabBarController ʹ͍ͬͯΔUINavigationController
ʹ͍ͬͯΔUIViewController → UITabBarController
Ҏ্ 13 ͷճసΛڐ͢ͱճసϩοΫͳͲͷ੍ޚ͕େมʹͳΓ ·͢ɻ චऀճసܥͷϝιουΛॻ͘߹ExtensionͰॻ͘ ͜ͱ͕ଟ͍Ͱ͢ɻ
Thank you!