Thanks Paul, your comment was helpful, and i was able to fix the problem but with the cost of retaining memory for the view i don't need. Here's whats happening:
I have a view (View A) which opens another view (View B). App Delegate method is responsible for opening both View A and View B. Application does not crashes on View A. I remove View A from window, and release it's controller object, and add View B to the window. I believe this is where i'm doing something wrong. Can you help me out with the code?
Here's the code for releasing View A and opening View B:
- (void)openViewB {
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:1.0];
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromLeft forView:window cache:YES];
// Remove viewControllerA from the window's view
[window removeFromSuperview];
// !-- Commenting out this block fixes the issue --!
// Release memory wired for viewControllerA view
if(viewControllerA) {
[viewControllerA release];
viewControllerA = nil;
}
// We call window:addSubView to add the viewB to the main window.
// You can use this call to add other views as child views not only to windows
// but to other views as well. (UIWindow is a subclass of UIView).
[window addSubview:viewControllerB.view];
[UIView commitAnimations];
// Override point for customization after application launch
[window makeKeyAndVisible];
}
I started the application with tab bar application template, and viewControllerB
is of type UITabBarController
. I'm definitely doing something wrong here. Any pointers?