0

I have an application UITabBar with 10 views. 4 views are displayed, 6 are in "More". In each of my views, there's a UIWebView and a navigation bar. Everything is optimized to fit automatically. Each file .m contains the following statement:

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

However, in iPad and iPhone, the application does not autorotate !

What can I do ?

EDIT @ 00h00 GMT +1 :

Menu with Device Orientation Supported is OK, but it doesn't work

user1530090
  • 705
  • 1
  • 5
  • 6
  • I would use `UIInterfaceOrientationIsPortrait(interfaceOrientation)` macro at first, so you will trap both directions (normal / reversed) and test it with that... and autorotation must be of course allowed on device (which i'm sure you've checked) and it must be allowed in all parent uiviewcontrollers... – Miro Hudak Jul 31 '12 at 21:59
  • What have I to add in my code to do this ? Thx – user1530090 Jul 31 '12 at 22:03
  • This is just a replacement for your `interfaceOrientation == UIInterfaceOrientationPortrait` but I'm not sure if it helps, it's just generally a good idea to use it instead to allow both portrait rotations. – Miro Hudak Jul 31 '12 at 22:05
  • Tested, doesn't help. Have you got another idea ? – user1530090 Jul 31 '12 at 22:08
  • Does it work at least in Simulator? Have you set Supported Device Orientations in Target > Info (or Target > Summary in that case, depending on XCode version)... and what about RootViewController's shouldAutorotate...()? it's also set to allow autorotation? – Miro Hudak Jul 31 '12 at 22:11
  • It doesn't work in Simulator also. I've checked in Target all rotations. What does is "RootViewController's shouldAutorotate...()" ? Thank you ! – user1530090 Jul 31 '12 at 22:13
  • 2
    I found the problem ! There were some views where (BOOL)shouldAutorotateToInterfaceOrientation was (interfaceOrientation **!=** UIInterfaceOrientationPortrait) and some other where (BOOL)shouldAutorotateToInterfaceOrientation was (interfaceOrientation **==** UIInterfaceOrientationPortrait). I changed all to : return YES; and it's work. Thank you Miroslav Hudak – user1530090 Jul 31 '12 at 22:16
  • This post may answer your question http://stackoverflow.com/questions/11861272/ios-rotation-using-tabbar-controller-locking-to-portrait/12061337#12061337 – Nelson Brian Aug 21 '12 at 19:16

0 Answers0