IOS某个ViewController禁止自动旋转

IOS屏幕自动旋转,强制横竖屏方法:

- (BOOL)shouldAutorotate
{
    return YES;
}

- (NSUInteger)supportedInterfaceOrientations
{
    return (UIInterfaceOrientationMaskAll);
}

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    return (interfaceOrientation == UIInterfaceOrientationPortrait);
}

要注意的地方:

如果在subViewController中复写rotate相关的方法是不会起作用的。

原文地址:https://www.cnblogs.com/androidwsjisji/p/3685790.html