How to enable autorotation when combining UITabBarController and UINavigationController and your own views « Tonny Xu
...Life is like a box of chocolates,
you never know what you’re gonna get...

My app is still not online now, because I have to fix some autorotation problems. Before today, I really didn’t know how to enable autorotation when my app is combined with UITabBarController and UINavigationController and my own views. After doing a little search, The solution is I need to enable autorotation for every view controller that will be presented in the UITabBarController.

Let’s assume we have a UITabBarController, theTabBarController and 3 UINavigationController named A, B, C. We need to set all the three controllers(A, B, C) to return YES in this method:

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    // Return YES for supported orientations
    return YES;
}

OK, now your tab bar and navigation bar and your views will be automatically rotated.

Share and Enjoy:
  • Print
  • Sphinn
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • FriendFeed
  • QQ书签
  • StumbleUpon
  • Technorati
  • 豆瓣

Comments
No Responses

Leave a Reply