views:

66

answers:

2

I have a subclass of UITabBarController which i am using so that i can rotate to use my app in landscape too.

How would i go about rotating my UI and getting each view controller to use a landscape view xib?

I have always just written apps before where returning YES for shouldAutorotate... handles it automatically for me... this isn't the case here now, as i'm using a custom view.

Thanks.

A: 

You don't need to subclass UITabBarController to get the autorotation behavior. Instead what you should do is have ALL the UIViewControllers that appear in your UITabBarController return YES for shouldAutorotateToInterfaceOrientation:. If even one of them does not, the UITabBarController will not autorotate.

As for the custom view, it is associated with a UIViewController, right? If so, then if your custom view implements layoutSubviews using the current view bounds to lay out all the subviews, then it should autorotate correctly as well.

Hilton Campbell
I tried setting all of my views to return YES, but it didnt seem to affect the auto rotation... what is layoutSubviews?
joec
Just to clarify, did you set the views to return YES, or their view controllers? The views won't get asked, only the view controllers will.
Hilton Campbell
I set the view controllers to return YES. How would i use layoutSubviews to lay out the subviews, using a xib? Thanks
joec
A: 

follow the code here- UITabBar, NavigationBar auto rotate

Vaibhav Saran