我的应用程序允许所有四个方向,但rootviewcontroller应该只允许纵向方向 .
我覆盖了rootviewcontroller中的supportedInterfaceOrientations方法,但是如果设备在应用程序启动时以横向方向保持,则视图控制器在横向方向上显示不正确,即使只允许纵向方向 . 这是iOS 8特定问题 .
override func supportedInterfaceOrientations() -> Int {
return UIInterfaceOrientation.Portrait.rawValue
}
2 回答
在ViewController中:
Swift版本:
对我来说,实现AppDelegate函数应用程序supportedInterfaceOrientationsForWindow就可以了
其中PortraitViewController应替换为根视图控制器类的名称