IOS某個ViewController禁止自動旋轉

IOS屏幕自動旋轉,強制橫豎屏方法:spa

- (BOOL)shouldAutorotate
{
    return YES;
}

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

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

要注意的地方:code

若是在subViewController中複寫rotate相關的方法是不會起做用的。blog

相關文章
相關標籤/搜索