水平尺寸 class 对于 iPhone 7 Plus 横向尺寸是否仍然紧凑?
Is horizontal size class still compact for iPhone 7 Plus on landscape?
根据 this or this 等参考资料,我认为 iPhone 7 Plus 横向尺寸应为常规尺寸 class。
这是当前视图控制器中的代码,根据 this reference:
- (void) traitCollectionDidChange: (UITraitCollection *) previousTraitCollection {
[super traitCollectionDidChange: previousTraitCollection];
NSLog(@"current trait collection: %@",self.traitCollection);
NSLog(@"previous trait collection: %@", previousTraitCollection);
}
这是在 iPhone 7 Plus 上从纵向变为横向时控制台上的输出:
current trait collection: <UITraitCollection: 0x1c44efd00; _UITraitNameUserInterfaceIdiom = Phone, _UITraitNameDisplayScale = 3.000000, _UITraitNameDisplayGamut = P3, _UITraitNameHorizontalSizeClass = Compact, _UITraitNameVerticalSizeClass = Compact, _UITraitNameTouchLevel = 0, _UITraitNameInteractionModel = 1, _UITraitNameUserInterfaceStyle = 1, _UITraitNameUserInterfaceLayoutDirection = 0, _UITraitNameForceTouchCapability = 2, _UITraitNamePreferredContentSizeCategory = UICTContentSizeCategoryL, _UITraitNameDisplayCornerRadius = 0.000000>
previous trait collection: <UITraitCollection: 0x1c02fa900; _UITraitNameUserInterfaceIdiom = Phone, _UITraitNameDisplayScale = 3.000000, _UITraitNameDisplayGamut = P3, _UITraitNameHorizontalSizeClass = Compact, _UITraitNameVerticalSizeClass = Regular, _UITraitNameTouchLevel = 0, _UITraitNameInteractionModel = 1, _UITraitNameUserInterfaceStyle = 1, _UITraitNameUserInterfaceLayoutDirection = 0, _UITraitNameForceTouchCapability = 2, _UITraitNamePreferredContentSizeCategory = UICTContentSizeCategoryL, _UITraitNameDisplayCornerRadius = 0.000000>
水平尺寸 class 保持紧凑,我预计会从紧凑变为常规。
使用 iOS 11.1.2 和 Xcode 9.1
您是否为设备打开了显示缩放功能?
https://help.apple.com/iphone/11/#/iphd6804774e
在"Standard"模式下,横向的水平尺寸class将为Regular。在 "Zoomed" 模式下,它将是 Compact。
根据 this or this 等参考资料,我认为 iPhone 7 Plus 横向尺寸应为常规尺寸 class。
这是当前视图控制器中的代码,根据 this reference:
- (void) traitCollectionDidChange: (UITraitCollection *) previousTraitCollection {
[super traitCollectionDidChange: previousTraitCollection];
NSLog(@"current trait collection: %@",self.traitCollection);
NSLog(@"previous trait collection: %@", previousTraitCollection);
}
这是在 iPhone 7 Plus 上从纵向变为横向时控制台上的输出:
current trait collection: <UITraitCollection: 0x1c44efd00; _UITraitNameUserInterfaceIdiom = Phone, _UITraitNameDisplayScale = 3.000000, _UITraitNameDisplayGamut = P3, _UITraitNameHorizontalSizeClass = Compact, _UITraitNameVerticalSizeClass = Compact, _UITraitNameTouchLevel = 0, _UITraitNameInteractionModel = 1, _UITraitNameUserInterfaceStyle = 1, _UITraitNameUserInterfaceLayoutDirection = 0, _UITraitNameForceTouchCapability = 2, _UITraitNamePreferredContentSizeCategory = UICTContentSizeCategoryL, _UITraitNameDisplayCornerRadius = 0.000000>
previous trait collection: <UITraitCollection: 0x1c02fa900; _UITraitNameUserInterfaceIdiom = Phone, _UITraitNameDisplayScale = 3.000000, _UITraitNameDisplayGamut = P3, _UITraitNameHorizontalSizeClass = Compact, _UITraitNameVerticalSizeClass = Regular, _UITraitNameTouchLevel = 0, _UITraitNameInteractionModel = 1, _UITraitNameUserInterfaceStyle = 1, _UITraitNameUserInterfaceLayoutDirection = 0, _UITraitNameForceTouchCapability = 2, _UITraitNamePreferredContentSizeCategory = UICTContentSizeCategoryL, _UITraitNameDisplayCornerRadius = 0.000000>
水平尺寸 class 保持紧凑,我预计会从紧凑变为常规。
使用 iOS 11.1.2 和 Xcode 9.1
您是否为设备打开了显示缩放功能?
https://help.apple.com/iphone/11/#/iphd6804774e
在"Standard"模式下,横向的水平尺寸class将为Regular。在 "Zoomed" 模式下,它将是 Compact。