iPhone. CATransition fades but I want sliding
开发者_如何学GoCATransition *animation = [CATransition animation];
[animation setDuration:0.5];
[animation setType:kCATransitionPush];
[animation setSubtype:kCATransitionFromBottom];
[animation setTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]];
[animation setDelegate:self];
[[self layer] addAnimation:animation forKey:@"popUpAni"];
The above code (contained within an object of UIView class) fades the view in. I want it to slide in, not fade.
No matter what I try:
[animation setType:kCATransitionMoveIn];
[animation setSubtype:kCATransitionFromTop];
The result remains the same. Am I doing something wrong?
EDIT: Sorry, I had that backwards, I meant to say the curlup animation shows as a fade animation on the simulator...
I know for sure the slide animation, just as you've written it, works on the simulator and of course the device. The code in my project is practically verbatim to yours.
Try changing the key you specify in the addAnimation method from "popUpAni" to something else. If that key is used somewhere else in your project, it may be causing this issue.
Also, have you confirmed you are using the correct version of the CoreAnimation Framework? You should be referencing and the QuartzCore.framework reference should be looking within the iPhoneOS frameworks folder.
精彩评论