Start CATransition at specific location
I have a CATransition (code below) that moves a view down. How can I specify a location for the animation to start, for example 60, 30.
Here's the code I'm currently using:
CATransition *animation = [CATransition animation];
[animation setDuration:0.5];
[animation setType:kCATransitionPush];
[animation setSubtype:kCATransitionFromBottom];
[anima开发者_开发问答tion setTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]];
Write your own timing function that does what you want?
EDIT: I was originally suggesting that you subclass CAMediaTimingFunction, but it looks like that might not do the right thing. Instead, try experimenting with setting CATransition.startProgress
, though it's a value in [0,1], not a number of pixels (if you're using a linear animation then it should be easy to convert).
I'm still not entirely sure what you mean by "a location for the animation to start", though — transitions apply to the entire view bounds. Normal UIView animations may be more likely to do what you want. If you give more details, it's easier to figure out what the problem you're trying to solve is.
精彩评论