在我的一个仅支持纵向方向的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;
}
Run Code Online (Sandbox Code Playgroud)
小智 0
使用此方法将其保持在纵向视图中:
[UIApplication sharedApplication].statusBarOrientation = UIInterfaceOrientationPortrait;
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2294 次 |
| 最近记录: |