the UIViewAnimationCurve only have
these functions.
but,I need like ExpoOut , BackInOut animation for UIView.
like ExpoOut is [CAMediaTimingFunction functionWithControlPoints:0.12 :0.51 :-0.4 :1];
I has used CABasicAnimation,but it can not change frame like UIView animation,it very bad when change the view size.
or,are you have any better way to change view frame like real,not look like zoomin.
thanks.
A problem here is that it's impossible to specify a timing function for a UIView-based animation. As far as I can tell you're then left with a slew of unpleasant options:
I hacked my way by setting the delegate to nil right before animating, and setting back to the UIView right after, but it feels very dirty. I may be missing something, though. My code looks something like this:
- (void)methodThatAnimates {
[CATransaction begin]; {
/* Must set to nil, otherwise the view just jumps to the new location. */
self.viewToAnimate.layer.delegate = nil;
CAMediaTimingFunction *timingFunction =
[CAMediaTimingFunction functionWithControlPoints:0.4 :0 :0 :1.0];
[CATransaction setAnimationTimingFunction:timingFunction]
self.viewToAnimate.layer.position = CGPoint(15.0, 0.0);
/* Set delegate back to the view, as is required per the
Apple documentation. */
self.viewToAnimate.layer.delegate = self.viewToAnimate;
} [CATransaction commit];
}
So far, it seems to work like a charm, but I keep expecting some bizarre artifact to show up because of the temporarily nil delegate.
You might want to take a look at MTAnimation. It's a UIView Category that provides jQuery like timing functions.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With