How to identify CAAnimation within the animationDidStop delegate?

Batgar’s technique is too complicated. Why not take advantage of the forKey parameter in addAnimation? It was intended for this very purpose. Just take out the call to setValue and move the key string to the addAnimation call. For example: [[hearingAidHalo layer] addAnimation:animation forKey:@”Throb”]; Then, in your animationDidStop callback, you can do something like: if … Read more

How to create custom easing function with Core Animation?

I found this: Cocoa with Love – Parametric acceleration curves in Core Animation But I think it can be made a little simpler and more readable by using blocks. So we can define a category on CAKeyframeAnimation that looks something like this: CAKeyframeAnimation+Parametric.h: // this should be a function that takes a time value between … Read more

iPhone UIView Animation Best Practice

From the UIView reference’s section about the beginAnimations:context: method: Use of this method is discouraged in iPhone OS 4.0 and later. You should use the block-based animation methods instead. Eg of Block-based Animation based on Tom’s Comment [UIView transitionWithView:mysuperview duration:0.75 options:UIViewAnimationTransitionFlipFromRight animations:^{ [myview removeFromSuperview]; } completion:nil];

Disabling implicit animations in -[CALayer setNeedsDisplayInRect:]

You can do this by setting the actions dictionary on the layer to return [NSNull null] as an animation for the appropriate key. For example, I use NSDictionary *newActions = @{ @”onOrderIn”: [NSNull null], @”onOrderOut”: [NSNull null], @”sublayers”: [NSNull null], @”contents”: [NSNull null], @”bounds”: [NSNull null] }; layer.actions = newActions; to disable fade in / … Read more

How do I apply a perspective transform to a UIView?

As Ben said, you’ll need to work with the UIView’s layer, using a CATransform3D to perform the layer’s rotation. The trick to get perspective working, as described here, is to directly access one of the matrix cells of the CATransform3D (m34). Matrix math has never been my thing, so I can’t explain exactly why this … Read more

UIView Infinite 360 degree rotation animation?

Found a method (I modified it a bit) that worked perfectly for me: iphone UIImageView rotation #import <QuartzCore/QuartzCore.h> – (void) runSpinAnimationOnView:(UIView*)view duration:(CGFloat)duration rotations:(CGFloat)rotations repeat:(float)repeat { CABasicAnimation* rotationAnimation; rotationAnimation = [CABasicAnimation animationWithKeyPath:@”transform.rotation.z”]; rotationAnimation.toValue = [NSNumber numberWithFloat: M_PI * 2.0 /* full rotation*/ * rotations * duration ]; rotationAnimation.duration = duration; rotationAnimation.cumulative = YES; rotationAnimation.repeatCount = repeat … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)