开发者

one view in landscape giving warning

开发者 https://www.devze.com 2023-02-13 02:54 出处:网络
I need just one view in my app to show in landscape, all is working but Im getting a warning I would like to get rid off, this is the code in the view controller for that view..

I need just one view in my app to show in landscape, all is working but Im getting a warning I would like to get rid off, this is the code in the view controller for that view..

in vie开发者_运维技巧wDidLoad

       [[UIDevice currentDevice] setOrientation:UIInterfaceOrientationLandscapeLeft];

and,

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

but I get the warning

UIDevice may not respont to -setOrientation:

in my viewDidLoad,

it works, but I dont like that warning, so how to fix this please??

thanks a lot!!


That is because the orientation property on UIDevice is read-only and you should not be setting it.

Read the Link that Max posted to find the proper way to set up an application to run in landscape mode.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号