开发者

popViewController doesnt seem to work with UIView animations

开发者 https://www.devze.com 2023-01-13 17:03 出处:网络
I have the following code, which does a nice animation when pushing a new view controller. [UIView beginAnimations:@\"animation\" context:nil];

I have the following code, which does a nice animation when pushing a new view controller.

[UIView beginAnimations:@"animation" context:nil];
[UIView setAnimationDuration:0.5];
[[self navigationController] pushViewController:details animated:NO];
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromLeft forView:self.navigationController.view cache:NO];
[UIView commitAnimations];

This code, using popViewController (rather than pushViewController) doesnt do the animation.

[UIView beginAnimations:@"animationback" context:nil];
[UIView setAnimationDuration:0.5];
[[self navigationController] popViewControllerAnimated:NO];
[UIView 开发者_Python百科setAnimationTransition:UIViewAnimationTransitionFlipFromLeft forView:self.navigationController.view cache:NO]; 
[UIView commitAnimations];

Any ideas why this would be and more importantly; how can I fix it?


Are you sure that self.navigationController.view really refers to the right view ... the one being animated? I have the feeling that the first case works only by accident. Shouldn't you refer to the view of the controller being pushed / popped?

0

精彩评论

暂无评论...
验证码 换一张
取 消