I have the following code to animate a layer in viewDidLoad in my view controller. Basically, I want the animation to show when the view is loaded.
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
UIView* mainview = self.view;
CompassLayer* cl = [CompassLayer new];
cl.frame = CGRectMake(30, 30, 200, 200);
[cl assembleSublayers];
[mainview.layer addSublayer:cl];
CAMediaTimingFunction* clunk = [CAMediaTimingFunction functionWithControlPoints:.9 :.1 :.7 :.9];
[CATransaction setAnimationDuration:0.8];
[CATransaction setAnimationTimingFunction:clunk];
cl.arrow.transform = CATransform3DRotate(cl.arrow.transform, M_PI/4.0, 0, 0, 1);
// CATransition* t = [CATransition animation];
// t.type = kCATransitionPush;
// t.subtype = kCATransitionFromBottom;
// [cl addAnimation:t forKey:nil];
}
The commented out transition animation works, but not the layer transform ones above. Can someone explain to me why?
Basically, the layer that I am trying to animate comes out in its final state.
Thank you.