Reputation: 23550
I have a main window that pops a modal view controller. When done in this modal view controller, it returns to the main window then dismisses itself. Then the main windows pops a new Modal view controller with animated=YES.
The problem is that the dismiss call that is done inside the first modalviewcontroller applies to both and SecondController is never shown.
Putting the first dismiss before or after the parent call does not change anything. If first dismiss is set wih animate= NO, everything works fine. But I need the animation.
- (void) entry {
FirstController *nextWindow = [[FirstController alloc] initWithNibName:@"theNIB" bundle:nil];
nextWindow.caller = self;
UINavigationController* navController = [[UINavigationController alloc] initWithRootViewController:nextWindow];
[self.navigationController presentModalViewController:navController animated:YES];
[nextWindow release];
[navController release];
}
- (void) thingsDoneInFirstModalController:(OBJECT)returnValue retval2:(OBJECT2)returnValue2 {
[self display2ndController];
}
- (void) display2ndController {
SecondController *nextWindow;
nextWindow = [[SecondController alloc] initWithNibName:@"NIB2" bundle:nil];
UINavigationController* navController = [[UINavigationController alloc] initWithRootViewController:nextWindow];
[self.navigationController presentModalViewController:navController animated:YES];
[navController release];
[nextWindow release];
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
[self.navigationController dismissModalViewControllerAnimated:YES];
[self.caller thingsDoneInFirstModalController:theResult retval2:someMoreResult];
}
What may I do ? I don't want to catch anything in view....Disapear...
Why does the dismiss colides as they are not called from the same navigation controller ?
Upvotes: 0
Views: 263
Reputation: 18497
The reason is likely the animation when you dismiss it. Try showing the second modal window using the performSelector:withObject:afterDelay:
, a method inherited from NSObject
. Reference here.
Upvotes: 2