2010-01-07 40 views
4

防止模式视图控制器被解雇的原因是什么?我发现dismissModalViewControllerAnimated并不总是工作?例如,这将不起作用:dismissModalViewControllerAnimated不总是有效?

SettingsViewController* settings = [[SettingsViewController alloc] init]; 
UINavigationController *settingsNav = [[UINavigationController alloc] initWithRootViewController:settings]; 
[navigationController presentModalViewController:settingsNav animated:YES];  
[navigationController dismissModalViewControllerAnimated:YES]; 

谢谢!

回答

5

如果您尝试将太多的导航动画放在一起太靠近,它们通常不起作用。尝试做你的dismissModalViewControllerAnimated:延迟0.75秒后。

0
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];