CATransaction Not Animating?

Your code would animate as expected if you were setting properties on a CALayer (they animate by default). For UIViews to animate, you must change their properties within a block like the following: UIView beginAnimations:nil context:NULL; UIView setAnimationDuration:1.0f; // Change properties here UIView commitAnimations CATransactions are used to group animations so that they are coordinated, or manually disable animations for a group of objects.

Your code would animate as expected if you were setting properties on a CALayer (they animate by default). For UIViews to animate, you must change their properties within a block like the following: UIView beginAnimations:nil context:NULL; UIView setAnimationDuration:1.0f; // Change properties here UIView commitAnimations; CATransactions are used to group animations so that they are coordinated, or manually disable animations for a group of objects.

1 Isn't that what the line "newView.layer. Frame = CGRectMake(20,20,220,220);" does? The 'layer' property accesses the CALayer of the UIView.

That should animate it, correct? – mazniak Apr 30 '09 at 15:13 You're right, I misread that line. In that case, what you're doing should animate.It's a little cleaner to use the UIView begin / commit animations block, but it should work the same.

– Brad Larson Apr 30 '09 at 18:13 1 What I think might be happening is that the run loop doesn't hit its end after you add the new subview, but before you trigger the animation. Therefore, it's just placing the view at its final position. Try moving the animation code to a separate method and trigger that method using performSelector:withObject:afterDelay: with a delay of 0.01 s.

That should let the animation activate after the subview has been added. – Brad Larson Apr 30 '09 at 18:17 Ahhhhh, I'm dumb. Code in my delegate was rendering/animating the views before running window addSubview:viewController.

View; I can't believe I didn't notice that earlier. – mazniak Apr 30 '09 at 19:38.

Can anyone help out or point me in the right direction of some Core-Animation reading material. I've already gone through all of Apple's stuff. See: Core Animation for Mac OS X and the iPhone: Creating Compelling Dynamic User Interfaces for an excellent walkthrough of Core Animation on views and layers.

Also the view animation block UIView beginAnimations... only has an effect when animating view properties--as opposed to layer properties. Keep in mind that this only performs the animation. Otherwise it will just snap back to its starting position.

Layer properties are animated implicitly whenever you set them except in the case where you are animating the root layer of a view. In that case animations are turned off by default and I've found that what I always have to do instead is animate the view rather than the layer when I am interested in animating the root. So what this means is that a call to any layer within your layer tree that makes a property change will be animated implicitly.

This is the only way I know (knew) you can actually use implicit animation on a layer.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions