iphone: How to do kCATransitionPush without any fa

2019-02-18 14:04发布

问题:

Possible Duplicate:
iPhone CATransition adds a fade to the start and end of any animation?

I want an animation of push between two sub views, just like ScrollView paging mode.

I know I can use UIScrollView directly, but the logic there is not so same with my program.

Anyway, I can use kCATransitionPush animation, but the bad thing of that is it does fading while pushing.

I really hate that fading, can anyone pls tell me how to remove that fading??

or how to do a UIScrollView-like paging pushing between two sub views?

Thanks very much.

回答1:

Just use normal UIView animations. You can use block-based animations, but I prefer the "traditional" style since it works on 3.0:

CGRect pageFrame = currentPage.frame;
CGFloat pageWidth = pageFrame.size.width;
nextPage.frame = CGRectOffset(pageFrame,pageWidth,0);
[UIView beginAnimations:nil context:NULL];
currentPage.frame = CGRectOffset(pageFrame,-pageWidth,0);
nextPage.frame = pageFrame;
[UIView commitAnimations];