I can\'t find any logical explanation, but the fact remains that, in iOS 5 (xCode 4.2), if I presentModalView:* animated:YES, I can call dismissModalViewAnimated:* fine, but
In iOS5 the managing of the lifecyle somehow changed and I cannot explain that issue in detail. Anyway, the fix is to postpone that workflow from applicationDidFinishLaunchingWithOptions to applicationDidBecomeActive. It seems that something isn't initialized right at the call of applicationDidFinishLaunchingWithOptions.
- (void)applicationDidFinishLaunchingWithOptions:... {
// in order to do this only at launching, but not on every activation
// Declaration as property for example
applicationDidLaunch = YES;
}
- (void) applicationDidBecomeActive:(UIApplication *)application {
if (applicationDidLaunch) {
applicationDidLaunch = NO;
[Start your login Workflow with modal view presenting here]
}
}
Curious to ur feedback :)....
I will add my 2 cents : i had ImagePickerController and got its dismissing working only when i did not release the picker manually (IOS 5 SDK).
So. for your case i could offer such workaround : 1. remove line - [loginController release]; 2. to prevent memory leaks add loginController as a property to your current controller and release it only in dealloc() of current controller :
@interface myViewController : UIViewController
@property (nonatomic, retain) LoginController *loginController;
@end
...
@implementation myViewController
- (void)showLoginPanel {
self.loginController = [[LoginController alloc] initWithNibName:@"LoginControllerGG" bundle:nil];
// ... something goes here
}
-(IBAction)loginClose()
{
// this should close all windows as far as you call it from current (main) controller
[self dismissModalViewControllerAnimated:YES];
// ... then anything you want EXCEPT [loginController release];
}
-(void)dealloc()
{
[loginController release];
}
@end
Good luck :)
P.S. I have just written this so it is just an idea how to cheat it. Somebosy may correct me ... though anyway it worked for me.