Question

Je peux « recroqueviller » un contrôleur de vue avec ce code:

[UIView beginAnimations:@"animation" context:nil];
[self.navigationController pushViewController:page animated:NO];
[UIView setAnimationDuration:1];
[UIView setAnimationTransition:UIViewAnimationTransitionCurlUp forView:self.navigationController.view cache:NO]; 
[UIView commitAnimations];

mais je ne peux pas la dernière courbe vers le bas la page comme ceci:

[UIView beginAnimations:@"animation" context:nil];
[self.navigationController popViewControllerAnimated:NO];
[UIView setAnimationDuration:1];
[UIView setAnimationTransition:UIViewAnimationTransitionCurlDown forView:self.navigationController.view cache:NO]; 
[UIView commitAnimations];

aucune idée pourquoi pas? Je veux juste vraiment « inverser » l'animation (comme si un autocollant a été enlevé pour montrer le contrôleur « de vue push'ed et le dos coincé quand ils cliquent sur un bouton).

Merci

Était-ce utile?

La solution

Ok, ma vieille réponse était tout à fait tort ... le problème est que vous popping le contrôleur de vue avant de la vue de la transition. Si vous modifiez le code à ceci:

[UIView beginAnimations:@"animation" context:nil];
[UIView setAnimationDuration:1];
[UIView setAnimationTransition:UIViewAnimationTransitionCurlDown forView:self.navigationController.view cache:NO]; 
[self.navigationController popViewControllerAnimated:NO];
[UIView commitAnimations];

il fonctionne très bien

Autres conseils

En utilisant OpenGL ou beaucoup de processus de CoreAnimation complexes, je suis sûr que vous pouvez, mais il serait beaucoup de tracas pour faire quelque chose comme ça. Quelque chose qui pourrait vous aider à long: Une application tournant simple livre entièrement écrit avec CoreAnimation

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top