Iphone SetStatusBaroOrientation:如何更改设备方向

Iphone SetStatusBaroOrientation:如何更改设备方向,iphone,iphone-sdk-3.0,Iphone,Iphone Sdk 3.0,我正在使用下面的代码将我的纵向视图更改为横向视图,效果很好 但我需要知道的是,在将视图更改为横向后,当我打印设备的当前方向时,它会为我提供“纵向”模式 此代码能否更改设备方向?如果是这样,那么当我检查当前方向时,为什么它显示为“纵向”模式 那么,如何以文档化的方式更改设备方向呢 请帮帮我 请看下面我的代码 [[UIApplication sharedApplication] setStatusBarOrientation: UIInterfaceOrientationLandscapeRight

我正在使用下面的代码将我的纵向视图更改为横向视图,效果很好

但我需要知道的是,在将视图更改为横向后,当我打印设备的当前方向时,它会为我提供“纵向”模式

此代码能否更改设备方向?如果是这样,那么当我检查当前方向时,为什么它显示为“纵向”模式


那么,如何以文档化的方式更改设备方向呢

请帮帮我

请看下面我的代码

[[UIApplication sharedApplication] setStatusBarOrientation:
UIInterfaceOrientationLandscapeRight];

UIScreen *screen = [UIScreen mainScreen];
CGFloat screenWidth = screen.bounds.size.width;
CGFloat screenHeight = screen.bounds.size.height;
UIView *navView = [[self navigationController] view];
navView.bounds = CGRectMake(0, 0, screenHeight, screenWidth);
navView.transform = CGAffineTransformIdentity;
navView.transform = CGAffineTransformMakeRotation(degreesToRadian(90));
navView.center = CGPointMake(screenWidth/2.0, screenHeight/2.0);
[UIView commitAnimations];

因为设备方向没有改变!您只需手动设置状态栏方向,并在视图上应用变换

那么,我如何才能以文档化的方式更改设备方向呢?简单回答:通过旋转设备,仅此而已;-)