UINavigationController Force Rotate

后端 未结 3 699
离开以前
离开以前 2020-11-30 06:20

My application is primarily portrait, however there is one view that REQUIRES a landscape orientation.

My views are contained within a UINavigationController, which

3条回答
  •  再見小時候
    2020-11-30 06:31

    This might help. You can call the following method upon appearing, where appropriate. e.g. in -viewWillAppear:animated

    attemptRotationToDeviceOrientation Attempts to rotate all windows to the orientation of the device.

    + (void)attemptRotationToDeviceOrientation
    

    Discussion

    Some view controllers may want to use app-specific conditions to determine the return value of their implementation of the shouldAutorotateToInterfaceOrientation: method. If your view controller does this, when those conditions change, your app should call this class method. The system immediately attempts to rotate to the new orientation. A rotation occurs so long as each relevant view controller returns YES in its implementation of the shouldAutorotateToInterfaceOrientation: method.

    Availability

    Available in iOS 5.0 and later. http://developer.apple.com/library/ios/#DOCUMENTATION/UIKit/Reference/UIViewController_Class/Reference/Reference.html

提交回复
热议问题