【问题标题】:one view in landscape giving warning风景中的一种观点发出警告
【发布时间】:2011-02-25 00:10:12
【问题描述】:

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

在 viewDidLoad 中

       [[UIDevice currentDevice] setOrientation:UIInterfaceOrientationLandscapeLeft];

和,

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

但我收到警告

UIDevice 可能无法响应 -setOrientation:

在我看来DidLoad,

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

非常感谢!!

【问题讨论】:

标签: iphone warnings landscape viewcontroller


【解决方案1】:

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

阅读Link that Max posted,找到设置应用程序以横向模式运行的正确方法。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-05-03
    • 2023-03-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多