Question

I have an iPhone application that I am currently converting to a universal binary to work with the iPad. I have successfully implemented everything I need in terms of layout so that full landscape functionality is now supported in my app (previously I primarily used portrait mode to display content).

But, I have one strange problem, and it ONLY occurs in landscape mode: when I push a view controller onto the stack, it takes two taps on the back button to return to the previous view controller! The first tap shows a blank view, but with the same name on the left-side back navigation button, the second tap takes the controller back to previous view like it should.

I don't have an iPad to test, so I am relying on the simulator. The problem does not show up on the iPhone and doesn't show up if you rotate back to portrait mode.

My app consists of a tabbarcontroller with navigation controllers loaded for its vc's:

//application delegate
- (void)applicationDidFinishLaunching:(UIApplication *)application
//....
WebHelpViewController *vc8 = [[WebHelpViewController alloc] init];
UINavigationController *nv8 = [[UINavigationController alloc] initWithRootViewController:vc8];

[self.tabBarController setViewControllers:[NSArray arrayWithObjects:nv1,nv2,nv3,nv4,nv5,nv6,nv7,nv8,nil]];

To implement landscape capability, the UITabBarController is overridden to autorotate when required:

//CustomTabBarController.m
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    return [[(UINavigationController *)self.selectedViewController topViewController] shouldAutorotateToInterfaceOrientation:interfaceOrientation];
}

... works fine. I navigate into new views using this method

SomeViewController *vc = [[SomeViewController alloc] init];
[self.navigationController pushViewController:vc animated:YES];
[vc release];

Is this only a simulation error? How do I fix this problem?

Was it helpful?

Solution

It sounds like another ViewController is responding to:

(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {

Check this first.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top