Reputation: 1098
I have a trouble with auto layout orientation. Simply i'm pushing view controller to take control from rootVC with this line of code
fooBar *foo = [[fooBar alloc]initWithNibName:@"fooBar" bundle:nil];
[self.navigationController pushViewController:foo animated:NO];
My fooBar view controller has auto layout so i should be able to get landscape orientation when i turned phone but phone still remaining to be in portrait mode.
Also strange part is i debug and methods below does not working to.. (i put them to fooBar VC)
(BOOL) shouldAutorotate{
return YES;
}
(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation
{
//returns true if want to allow orientation change
return TRUE;
}
build options Ios SDK 6.0, Xcode 5.1
Upvotes: 1
Views: 111
Reputation: 1094
This is probably because the navigation controller doesn't forward those method calls. If you want it to, you will need to create your own custom navigation controller and follow this pattern:
- (BOOL)shouldAutorotate
{
return [self.visibleViewController shouldAutorotate];
}
- (NSUInteger)supportedInterfaceOrientations
{
return [self.visibleViewController supportedInterfaceOrientations];
}
So in summary, create your own concrete implementation of UINavigationController, and then forward the above two methods to whatever view controller is currently visible. You should then notice those methods being called in your fooBar class.
Upvotes: 2
Reputation: 1885
Please check in the project settings whether you have these orientation checked.
Upvotes: 0