My application uses several libraries. Basically KYDrawerController . I want my application to use only orientation orientation, but for one ViewControllar I need both landscapes and Potrait.
I have a search for any solution on the Internet. each solution was a subclass of the NavigationControllar and Override ShouldAutoRotate methods. but not of them worked for me.
and here is a rough overview of the entire StoryBoard
the gray color of the View is the KYDrawerControllar view that libry uses to work as a NavigationDrawer, such as Android.
I created a custom class for the Control Controllar and subclassed it to the required ViewControllar Navigation Controllar.
here is the code
class SettingsNavigation: UINavigationController { override func viewDidLoad() { super.viewDidLoad() NSLog("visibleControllar", self.visibleViewController!.debugDescription)
}
here is the ViewControllar
class Settings: UIViewController { // MARK: - Outlets @IBOutlet var profileImage: UIImageView! @IBOutlet var profileName: UILabel! @IBOutlet var profileRegistrationType: UILabel! @IBOutlet var logOutButton: FUIButton! @IBOutlet var subscriptionType: UILabel! @IBOutlet var subscriptionRegistrationType: UILabel! @IBOutlet var upgradeSubscriptionButton: FUIButton! override func shouldAutorotate() -> Bool { /* if (UIDevice.currentDevice().orientation == UIDeviceOrientation.LandscapeLeft || UIDevice.currentDevice().orientation == UIDeviceOrientation.LandscapeRight || UIDevice.currentDevice().orientation == UIDeviceOrientation.Unknown) { return false; } else { return true; }*/ return false } override func supportedInterfaceOrientations() -> UIInterfaceOrientationMask { return UIInterfaceOrientationMask.Portrait } }
and I use StoryBoard segues to represent ViewControllars.
please help me with this.
Gishantha jayasooriya
source share