override var shouldAutorotate: Bool{
return false
}
override var supportedInterfaceOrientations: UIInterfaceOrientationMask{
if UIDevice.current.userInterfaceIdiom == UIUserInterfaceIdiom.phone {
return UIInterfaceOrientationMask.portrait
} else {
return UIInterfaceOrientationMask.landscapeRight
}
}
override var preferredInterfaceOrientationForPresentation: UIInterfaceOrientation{
if UIDevice.current.userInterfaceIdiom == UIUserInterfaceIdiom.phone {
return UIInterfaceOrientation.portrait
} else {
return UIInterfaceOrientation.landscapeRight
}
}
楼主之前遇到一个坑,真的是很不解,就是个demo,不知道怎么就弄出一个怪事。。。。一般我们的项目里只会有这个红圈里的配置
但是楼主的项目里,不知道怎么弄的,莫名其妙的出现了这个
这个东西直接导致了楼主上面那段代码对iPad毫无作用,甚至系统对这段代码完全不响应。。。楼主分析这个独特的配置应该是为了方便universal项目,但俩种设备的转向又不同的项目。。。总之这个独特又方便的配置,如果使用,那么上面那段代码就会失效