iOS 8 時代の UISplitViewController
2014.10.3 クラスメソッド株式会社
田宮 宙比己
自己紹介
• 田宮 宙比己 (たみや ときひこ)
• @Cocominap
• クラスメソッド株式会社
• AWS & iOS
様々なデバイス 様々な画面サイズ
そこで
Adaptive
Size Class
Regular
Compact
Size Class
Regular Compact
Regular
Compact
Horizontal
Vertical
iPad
Apple Watch?
iPhone 5s / 6
Regular
Compact
Portrait
Horizontal
Vertical
iPhone 5s / 6Regular
Compact Landscape
Horizontal
Vertical
traitCollection
プロパティ// UITraitCollection.h !
UIUserInterfaceSizeClass horizontalSizeClass; UIUserInterfaceSizeClass verticalSizeClass; UIUserInterfaceIdiom userInterfaceIdiom; CGFloat displayScale;
enum// UIInterface.h !
typedef NS_ENUM(NSInteger, UIUserInterfaceSizeClass) { UIUserInterfaceSizeClassUnspecified = 0, UIUserInterfaceSizeClassCompact = 1, UIUserInterfaceSizeClassRegular = 2, } NS_ENUM_AVAILABLE_IOS(8_0);
- (void)traitCollectionDidChange:(UITraitCollection *)previousTraitCollection { NSLog(@"[previous] \n %@", previousTraitCollection); NSLog(@"[now] \n %@", self.traitCollection); }
NSLog
previousTraitCollection
_UITraitNameUserInterfaceIdiom = Phone, _UITraitNameDisplayScale = 2.000000, _UITraitNameHorizontalSizeClass = Compact, _UITraitNameVerticalSizeClass = Regular, _UITraitNameTouchLevel = 0, _UITraitNameInteractionModel = 1
iPhone5
NSLog
self.traitColletction
_UITraitNameUserInterfaceIdiom = Phone, _UITraitNameDisplayScale = 2.000000, _UITraitNameHorizontalSizeClass = Compact, _UITraitNameVerticalSizeClass = Compact, _UITraitNameTouchLevel = 0, _UITraitNameInteractionModel = 1
iPhone5
NSLog
UISplitViewController
CompactRegular
iPad (Landscape)
iPhone 5s (Landscape)
iPhone 6 (Landscape)
iPhone 6 Plus (Landscape)
実装にどう活かす
• 回転の検知
• didRotateFromInterfaceOrientation:
画面状況に最適な UIを提供できる
7%8%10%11%
29%
35%
This is test text of what I think of my This is a test text of what I think of my This is a test text of what I think of my This is a test text of what I think of my 1908
7%8%10%11%
29%
35%
This is test text of what I think of my This is a test text of what I think of my This is a test text of what I think of my This is a test text of what I think of my 1908
Graph 1Graph 1Graph 2
Graph 3
Graph 4
Graph1
エンジニアを募集中
クラスメソッド 検索
Android
ありがとうございました