2010-01-07 69 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]; 
相關問題