0

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 viewDidLoad

       [[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!!

manuelBetancurt
  • 15,428
  • 33
  • 118
  • 216
  • 2
    http://stackoverflow.com/questions/181780/is-there-a-documented-way-to-set-the-iphone-orientation – Max Feb 25 '11 at 00:16

1 Answers1

0

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.

Community
  • 1
  • 1
Simon Goldeen
  • 9,080
  • 3
  • 36
  • 45