自动旋转代码失败

时间:2013-08-04 02:47:55

标签: iphone objective-c ios6

我有以下代码来阻止视图自动旋转。但是在IOS 6中它不起作用。我该怎么办?

- (BOOL)shouldAutorotate {
    return NO;
}

- (NSUInteger)supportedInterfaceOrientations {
    return UIInterfaceOrientationMaskPortrait;
}
// pre-iOS 6 support
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation {
    return (toInterfaceOrientation == UIInterfaceOrientationPortrait);
}

0 个答案:

没有答案