0

我只需要我的应用程序中的一个视图以横向显示,一切正常,但我收到一个警告我想摆脱,这是该视图的视图控制器中的代码..

在 viewDidLoad

       [[UIDevice currentDevice] setOrientation:UIInterfaceOrientationLandscapeLeft];

和,

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
return (interfaceOrientation == UIInterfaceOrientationLandscapeLeft);
}

但我收到警告

UIDevice 可能无法响应 -setOrientation:

在我看来DidLoad,

它有效,但我不喜欢那个警告,那么请问如何解决这个问题?

多谢!!

4

1 回答 1

0

那是因为 UIDevice 上的方向属性是只读的,你不应该设置它。

阅读Max 发布的链接,找到设置应用程序以横向模式运行的正确方法。

于 2011-02-25T00:35:08.023 回答