Reputation: 3166
What prevents a modal view controller from being dismissed? I've found dismissModalViewControllerAnimated doesn't always work? For example this won't work:
SettingsViewController* settings = [[SettingsViewController alloc] init];
UINavigationController *settingsNav = [[UINavigationController alloc] initWithRootViewController:settings];
[navigationController presentModalViewController:settingsNav animated:YES];
[navigationController dismissModalViewControllerAnimated:YES];
Thanks!
Upvotes: 4
Views: 1715
Reputation: 3441
SettingsViewController* settings = [[SettingsViewController alloc] init];
UINavigationController *settingsNav = [[UINavigationController alloc] initWithRootViewController:settings];
[navigationController presentModalViewController:settingsNav animated:YES];
[settingsNav dismissModalViewControllerAnimated:YES];
If SettingsViewController it's UIViewController then:
SettingsViewController* settings = [[SettingsViewController alloc] init];
[self presentModalViewController:settings animated:YES];
[settings dismissModalViewControllerAnimated:YES];
Upvotes: 1
Reputation: 85542
If you try to do too many navigation animations too close together, they usually won't work. Try doing your dismissModalViewControllerAnimated: after a delay of 0.75 seconds.
Upvotes: 5