当某个图像仍然可见时,我会尝试将屏幕方向锁定为仅横向,然后当图像被隐藏时,解锁所有方向(针对 iOS 6):
-(BOOL)shouldAutorotate{
if (self.splashImageView.hidden == NO) {
return UIInterfaceOrientationMaskPortrait;//gets called when image is visible
}else{
return UIInterfaceOrientationMaskAll;//gets called when image is hidden
}
}
- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration {
[self shouldAutorotate];
}
正如您可能注意到的那样,shouldAutorotate
它被正确调用,但即使图像仍然可见,屏幕也始终支持横向,是否缺少某些内容?
PS:请注意我试图让它在标签栏视图控制器(一个UIViewController
子类)上工作。