one view in landscape giving warning
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.
精彩评论