在我的一个仅支持纵向方向的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;
}
1 回答
使用此方法将其保留在纵向视图中: