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
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.