Reputation: 9912
I'm currently pulling my hair out solving this bug :/ I have already tried the solutions from other SO threads regarding this topic but had no luck so far.
Here's what's wrong: I have a UINavigationController that pushes View A, from View A I can press a button to push View B - works fine. But when I push View B, then rotate the screen into landscape mode and then click the back button, I get the following output in the console and the view switching is not animated, just switches from B back to A:
2012-01-02 20:50:42.866 [13345:f803] Unbalanced calls to begin/end appearance transitions for <DimensionConversionViewController: 0x68831f0>.
2012-01-02 20:50:42.868 [13345:f803] attempt to dismiss modal view controller whose view does not currently appear. self = <UINavigationController: 0x6b541a0> modalViewController = <UISnapshotModalViewController: 0x6da5190>
This is how I push the View B into the stack:
- (void) showConverter:(id)sender {
[self.navigationController pushViewController:converter animated:YES];
}
-viewDidLoad of View B:
- (void) viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view from its nib.
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(updateInterface) name:@"UIDeviceOrientationDidChangeNotification" object:nil];
// ... Update text fields ...
[self updateInterface];
}
-viewDidUnload of View B:
- (void)viewDidUnload
{
[super viewDidUnload];
// Release any retained subviews of the main view.
// e.g. self.myOutlet = nil;
[[NSNotificationCenter defaultCenter] removeObserver:self name:@"UIDeviceOrientationDidChangeNotification" object:nil];
}
If you have questions or need more code samples, please let me know.
Thanks in advance for any help :-)
Upvotes: 2
Views: 6903
Reputation: 9912
Turned out that in my case the root cause of the problem was, that I forgot to update all the shouldAutorotateToInterfaceOrientation:
methods in the different view controllers to return YES for all UIInterfaceOrientations
(or let's say they should all return the sam). Doing this solved the issue.
Upvotes: 11