Ios 如何旋转方向?
当我从UINavigationController的纵向模式切换到UIViewController的横向模式时,我想旋转方向,但它不起作用 我试过了Ios 如何旋转方向?,ios,swift,uinavigationcontroller,viewcontroller,Ios,Swift,Uinavigationcontroller,Viewcontroller,当我从UINavigationController的纵向模式切换到UIViewController的横向模式时,我想旋转方向,但它不起作用 我试过了 (UIApplication.shared.delegate as! AppDelegate).window!.rootViewController = playModeVc 但我可以在纵向模式下看到下一个viewController,但我希望在横向模式下看到它。当我使用 present(playModeVc, animated: true, c
(UIApplication.shared.delegate as! AppDelegate).window!.rootViewController = playModeVc
但我可以在纵向模式下看到下一个viewController,但我希望在横向模式下看到它。当我使用
present(playModeVc, animated: true, completion: nil)
它不会释放内存
我想在切换viewController时释放内存。如何才能做到这一点?我从您的问题中了解到,您希望强制一个视图控制器始终以横向模式显示 下面是如何在Swift 3中实现这一点。将以下代码添加到要在横向视图中显示的视图控制器:
override var supportedInterfaceOrientations: UIInterfaceOrientationMask {
return UIInterfaceOrientationMask.landscape
}
override var shouldAutorotate: Bool {
return false
}
我做了,但没用。。。我有4个纵向模式的视图控制器,但我需要一个横向模式的控制器。。。