2010-01-07 9 views
4

Qu'est-ce qui empêche le rejet d'un contrôleur de vue modale? J'ai trouvé que la fonction de renvoiModalViewControllerAnimated ne fonctionne pas toujours? Par exemple cela ne fonctionnera pas:dismissModalViewControllerAnimated ne fonctionne pas toujours?

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

Merci!

Répondre

5

Si vous essayez de faire trop d'animations de navigation trop rapprochées, elles ne fonctionneront généralement pas. Essayez de faire votre rejectModalViewControllerAnimated: après un délai de 0,75 secondes.

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

Si SettingsViewController il est UIViewController alors:

SettingsViewController* settings = [[SettingsViewController alloc] init]; 
[self presentModalViewController:settings animated:YES]; 
[settings dismissModalViewControllerAnimated:YES]; 
Questions connexes