0

Im using

UIView animateKeyframesWithDuration

and i have 3 animation sections using

[UIView addKeyframeWithRelativeStartTime

However, on one of the key frames I want to easeIn.

How can I add an easing function to this?

bandejapaisa
  • 26,576
  • 13
  • 94
  • 112

1 Answers1

0

Here is a trustworthy article: https://developer.apple.com/library/ios/documentation/Cocoa/Conceptual/Animation_Types_Timing/Articles/Timing.html You will have to deal with CAAnimation, not just UIView.

Update: As the PO didn't make it so far, there are some catches on what could go wrong: a) Make sure that your animation is created and added like follows:

CABasicAnimation* fadeAnim = [CABasicAnimation animationWithKeyPath:@"opacity"];
fadeAnim.fromValue = [NSNumber numberWithFloat:1.0];
fadeAnim.toValue = [NSNumber numberWithFloat:0.0];
fadeAnim.duration = 1.0;
[theLayer addAnimation:fadeAnim forKey:@"opacity"];

// Change the actual data value in the layer to the final value.
theLayer.opacity = 0.0;

For more details see: https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/CoreAnimation_guide/CreatingBasicAnimations/CreatingBasicAnimations.html

b) When you use animateTransition:, make sure that:

All animations must take place in the view specified by the containerView property of transitionContext.

(visit https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIViewControllerAnimatedTransitioning_Protocol/#//apple_ref/occ/intfm/UIViewControllerAnimatedTransitioning/animateTransition: for reference). Hope this will help you sort all the issues out.

Arthur Gevorkyan
  • 2,069
  • 1
  • 18
  • 31