Hi,
I have a tab bar application with 5 tabs.
Most of the application is in portrait mode and shouldn't change when the device orientation changes.
I do need to achieve this change "only" in 2 places.
In the first tab I have a navigation controller consisting of a table view with 2 rows.
Clicking each row pops a different (new) view controller.
These 2 view controllers are the only places in my app that require "special" actions when the device changes orientation, meaning a totally new view for some of the elements in them (which I achieved).
I am having 2 problems:
1. I can only get the
whole application to rotate, including the tab bar.
For this, as suggested
here I added this category addition code to my MainAppDelegate:
Code:
@interface UITabBarController (MyApp)
@end
@implementation UITabBarController (MyApp)
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation {
return (toInterfaceOrientation == UIInterfaceOrientationPortrait ||
toInterfaceOrientation == UIInterfaceOrientationLandscapeRight);
}
@end
As stated, I want the entire app to always stay in portrait mode but those 2 places, and them only. Can this be done? I understand the tab bar controller is the root controller of the entire app, but can I somehow control the action/no action for device orientation change when inside the different tabs and even further - their children?
2. In those 2 places I need the landscape view to take over the entire screen, including the bottom of the screen being used for the tab bar.
As I see when rotated right now, my new view is placed "under" the tab bar.
Thank you very much,
omerv