退出后返回主屏幕时,无法返回有关其traitCollection
的任何信息。我想得到它的大小等级,但这是不可能的。
当我在没有任何segue的情况下运行屏幕时,它拥有所有信息:
print(self.view.traitCollection)
<UITraitCollection: 0x14fe47dd0; _UITraitNameUserInterfaceIdiom = Phone, _UITraitNameDisplayScale = 2.000000, _UITraitNameHorizontalSizeClass = Compact, _UITraitNameVerticalSizeClass = Regular, _UITraitNameTouchLevel = 0, _UITraitNameInteractionModel = 1, _UITraitNameForceTouchCapability = 1>
但是当屏幕在自定义segue之后运行时,这就是它显示的内容:
print(self.view.traitCollection)
<UITraitCollection: 0x14fe21cc0; >
它没有关于视图的任何信息。
自定义segue的代码如下:
override func perform() {
self.sourceViewController.presentViewController(self.destinationViewController as UIViewController, animated: false, completion: nil)
}