Hey i came up with a Workaround myself now.
To Recap the Problem Only the first addet View to the Window will recognize Orientation Changes.
I Subclassed My TabBarController and made it ro Rotate to the Interface Orientation
- (void) willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration {
[self adjustViewsForOrientation:toInterfaceOrientation];
}
- (void) adjustViewsForOrientation:(UIInterfaceOrientation)orientation {
if (orientation == UIInterfaceOrientationLandscapeLeft || orientation == UIInterfaceOrientationLandscapeRight) {
NSLog(@"Landscape");
//Do Your Landscape Changes here
}
else if (orientation == UIInterfaceOrientationPortrait || orientation == UIInterfaceOrientationPortraitUpsideDown) {
NSLog(@"Portrait");
//Do Your Portrait Changes here
}
}
But now the "viewControllers" of my TabBarController wont still recognize my InterfaceOrientations. So i came up with The folowing:
- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation {
for (int i = 0; i < [self.viewControllers count]; i++ ) {
[[self.viewControllers objectAtIndex:i] didRotateFromInterfaceOrientation:fromInterfaceOrientation];
}
}
This will call the didRotateFromInterfaceOrientation Method from all Subclasses of the TabBarController:
- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation{
[self adjustViewsForOrientation:self.interfaceOrientation];
}
- (void) adjustViewsForOrientation:(UIInterfaceOrientation)orientation {
if (orientation == UIInterfaceOrientationLandscapeLeft || orientation == UIInterfaceOrientationLandscapeRight) {
NSLog(@"Subview Landscape");
//Do Your Landscape Changes here
}
else if (orientation == UIInterfaceOrientationPortrait || orientation == UIInterfaceOrientationPortraitUpsideDown) {
NSLog(@"Subview Portrait");
//Do Your Portrait Changes here
}
}
As You can see i call [self adjustViewsForOrientation:self.interfaceOrientation];
in my Sub Viewcontroller which will give the actuall Orientation to the adjust method. If you use fromInterfaceOrientation it will be the wrong Orientation, because the change was already done!
My other problem was the UISplitviewController in TabBarController, but i dident got it working in a acceptable way. The problem is the same as for the UIViewControllers. It wont regocnize Orientation Changes so you have to Subclass it, but i dident get it working to 100%. As i searched the Web i found a good Code Example for a cutsom build Splitview. So ull maybe give it a shot:
http://blog.trustedones.com/development/ipad-uisplitviewcontroller-replacement-for-sethidesmasterviewinportrait
http://www.trustedones.com/apps/ipad
It also keeps the SplitView in Portrait Mode so you maybe will like it. I do!
Hope i could help someone with this post..
Cheers
nettz