是什么阻止了模态视图控制器被解雇?我发现dismissModalViewControllerAnimated并不总是有用吗?例如,这不起作用:
SettingsViewController* settings = [[SettingsViewController alloc] init];
UINavigationController *settingsNav = [[UINavigationController alloc] initWithRootViewController:settings];
[navigationController presentModalViewController:settingsNav animated:YES];
[navigationController dismissModalViewControllerAnimated:YES];
谢谢!
答案 0 :(得分:5)
如果您尝试将太多导航动画放得太近,它们通常无法正常工作。尝试执行你的dismissModalViewControllerAnimated:延迟0.75秒后。
答案 1 :(得分:1)
SettingsViewController* settings = [[SettingsViewController alloc] init];
UINavigationController *settingsNav = [[UINavigationController alloc] initWithRootViewController:settings];
[navigationController presentModalViewController:settingsNav animated:YES];
[settingsNav dismissModalViewControllerAnimated:YES];
如果SettingsViewController它是UIViewController,那么:
SettingsViewController* settings = [[SettingsViewController alloc] init];
[self presentModalViewController:settings animated:YES];
[settings dismissModalViewControllerAnimated:YES];