【发布时间】:2016-02-17 11:00:07
【问题描述】:
我呈现的视图在水平尺寸类别为 Regular 时看起来像 popover,而在水平尺寸等级是Compact。
效果很好,在带有 SplitView 的 iPad 上,它可以正确调整大小,并且在任何 not+ iphone 中都可以很好地作为弹出框,但在 iPhone 6+ 中,方法,
adaptivePresentationStyleForPresentationController(controller: UIPresentationController, traitCollection: UITraitCollection) -> UIModalPresentationStyle
被调用了 3 次(仅在纵向模式下,在横向模式下正常工作),第一次返回一切正确(对于紧凑视图)但另外两次特征集合水平大小类被认为是常规的,所以它搞砸了我对视图执行的布局更新。
我想知道为什么这台设备会发生这种情况(正如我所说,在 iPad 中使用 SplitView 调整大小效果很好),以及它是否可以解决。可能是一个来自超级视图的问题,它迫使一个特征发生变化?
这是我的adaptivePresentationStyleForPresentationController 方法
public func adaptivePresentationStyleForPresentationController(controller: UIPresentationController, traitCollection: UITraitCollection) -> UIModalPresentationStyle {
if controller.presentedViewController is ColorPickerCollectionViewController {
colorPickerVC.collectionView?.setCollectionViewLayout(colorPickerFlowLayout(traitCollection), animated: true)
}
return (traitCollection.horizontalSizeClass == .Compact) ? .FullScreen : .None
}
事实证明,它在全屏模式下将视图呈现为模式视图,除了最后两次返回 .None,但我的 collectionViewLayout 会更新这些迭代。
提前致谢
【问题讨论】:
标签: ios swift autolayout iphone-6-plus