I have created an application for iPhone, using swift, that is composed from many views embedded in a navigation controller. I would like to lock the main v
When UIKit detects a change in device orientation, it uses the UIApplication
object and the root view controller to determine whether the new orientation is allowed. If both objects agree that the new orientation is supported, then auto-rotation occurs. Otherwise, the orientation change is ignored.
By default, the UIApplication
object sources its supported interface orientations from the values specified for the UISupportedInterfaceOrientations
key in the applications' Information Property List. You can override this behavior by implementing the application:supportedInterfaceOrientationsForWindow:
method in your application's delegate. The supported orientation values returned by this method only take effect after the application has finished launching. You can, therefore, use this method to support a different set of orientations after launch.
Allowing your app to rotate into portrait after launch.
- (NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window
{
return UIInterfaceOrientationMaskAllButUpsideDown;
}
source: https://developer.apple.com/