View Flip Issue
I have a single view controller controller controlling the flip of two views. This is something similar to Phone app in iPhone wherein when you make a call and tap on the keyboard item, the view flips.
Now when I am trying to flip the view on some selection, it flips correctly to show my second view but on second flip to show back my first screen, flip is not smooth and I can see my first view flipping, staying for a second, then second view goes away and then first view come up. This happens everytime.
Below is the code I am executing when tapping on the first view to flip to second view:
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:0.75];
[UIView setAnimationTransition:([self.mainView superview] ?
UIViewAnimationTransitionFlipFromLeft : UIViewAnimationTransitionFlipFromRight)
forView:self.containerView cache:YES];
[self.mainView removeFromSuperview];
[self loadRequestView];
[UIView commitAnimations];
Below is the code I am executing when tapping on the second view to flip to first view:
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:0.75];
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromRight
forView:self.containerView cache:YES];
[self.mainView removeFromSuperv开发者_开发技巧iew];
[self loadLandingView];
[UIView commitAnimations];
Both loadRequestView and loadLandingView are setting my self.mainView to appropriate view.
Any clue whats wrong here?
Since it looks like you are juggling a lot with your views, might it be that the caching is getting in the way? If you set cache:YES the animation will be made with a cached image of the original view and the new view only gets redrawn after the animation is finished. Try setting cache:NO
精彩评论