IOS某个ViewController禁止自动旋转

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

- (BOOL)shouldAutorotate
{
    return YES;
}

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

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

要注意的地方:code

若是在subViewController中复写rotate相关的方法是不会起做用的。blog

相关文章
相关标签/搜索