根据像thisthis这样的引用,我认为风景上的iPhone 7 Plus应该具有常规的大小级别。

这是当前视图控制器中的代码,按照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>

水平尺寸类保持紧凑,我希望从紧凑型变为常规型。

使用iOS 11.1.2和Xcode 9.1

最佳答案

您是否已打开设备的显示缩放?

https://help.apple.com/iphone/11/#/iphd6804774e

在“标准”模式下,横向中的水平尺寸类别将为“常规”。在“缩放”模式下,它将是紧凑的。

关于ios - iPhone 7 Plus的水平尺寸等级仍然紧凑吗?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/47639547/

10-13 04:40