我有一个仅支持竖屏的ViewController。然而当设备旋转时,状态栏会旋转到横屏模式,但是视图仍然保持竖屏模式。我想要禁止状态栏的旋转。这个问题只在IOS7中出现。
// Overridden function to allow orientations other than the default portrait orientation.
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone)
{
// iPhone: support only upright portrait
return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
else
{
// iPad: any orientation is OK
return YES;
}
}
// For iOS6.0 Rotate
- (BOOL)shouldAutorotate
{
return NO;
}