UITabBar in iPad - Won't go into landscape mode with more than 2 items
I created a new project and selected the Tab Bar template for iPad. I opened it up in Interface Builder and added 4 more items, bringing the total items to 6. I did a build and run and it opened up fine in the iPad simulator, but it wouldn't go into landscape! I then backtracked in interface builder and found that it would go landscape if there were only 2 items in the tab bar, but not if there were any more. The simulator rotates but all the content (currently just the placeholders put in place by Apple) stay开发者_开发问答s as if it was portrait. Any ideas why?
All of your views that are included in the UITabBar have to support horizontal view in order for the container to support it.
From the Apple Docs: When a device orientation change occurs, the tab bar controller queries its array of view controllers. If any one of them does not support the orientation, the tab bar controller does not change its orientation.
Reference: http://developer.apple.com/library/ios/#featuredarticles/ViewControllerPGforiPhoneOS/TabBarControllers/TabBarControllers.html#//apple_ref/doc/uid/TP40007457-CH102-SW26
So make sure all of your views are supporting the horizontal view by having a method like this in them:
-(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation{
return YES;
}
精彩评论