shouldAutorotateToInterfaceOrientation won't work!

Posted by Dror Sabbag on Stack Overflow See other posts from Stack Overflow or by Dror Sabbag
Published on 2010-05-19T18:07:21Z Indexed on 2010/05/19 18:10 UTC
Read the original article Hit count: 549

Hey.

I've been writing my Universal application in portrait mode, and now after about 15 nib files, many many viewCotnrollers, i'd like to implement the shouldAutorotateToInterfaceOrientation and desing some screens in Landscape mode.

adding :

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

to ALL of my viewControllers, does not do the work.

During Debug, i see that this method is called, but it just won't work! not in the simulator, not in the device, not in Iphone, not in Ipad!

i've searched some answers in the forum, and saw some advises to use:

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
 return (interfaceOrientation == UIInterfaceOrientationPortrait ||
   interfaceOrientation == UIInterfaceOrientationLandscapeLeft || 
   interfaceOrientation == UIInterfaceOrientationLandscapeRight ||
   interfaceOrientation == UIInterfaceOrientationPortraitUpsideDown );
} 

Didn't worked either,

adding:

[[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications];

and

[[UIDevice currentDevice] endGeneratingDeviceOrientationNotifications];

to my viewDidLoad and viewDidUnload respectively didn't worked either.

I'm lost.. Any help will do!

just one more info... all my Views are of type UIControl, as i needed the TuchUpInside to work.

Appriciate your help.

© Stack Overflow or respective owner

Related posts about screen-orientation

Related posts about iphone