views:

651

answers:

2

Is there any problem applying multiple transforms to a UIView and it's corresponding CALayer?

Specifically, can you "mix and match" CATransform3Ds with CGAffineTransforms without running into issues?

Also are there any problems with setting some transforms directly while animating another transform change simultaneously?

Are there any "rules" for how this should be done, or any design patterns for this?

+1  A: 

I realize this doesn't answer the question entirely (or come close), but if you're only working with CGAffineTransforms you can use CGAffineTransformConcat() to combine multiple transforms.

This will work just fine when some transforms are animated and others are not, as long as you concat the transformations properly. I don't know how this works when you're also doing layer transforms.

pix0r
A: 

pix0r is right but here is some more info on this. The official docs for CGAffineTransformConcat():

http://tinyurl.com/38evcq3

Also, here is a quick example:

// Rotate 45 degrees
CGAffineTransform rotate = CGAffineTransformMakeRotation(45*(3.1415927/180));
// Move to the left
CGAffineTransform translate = CGAffineTransformMakeTranslation(-50,0);
// Apply them to a view
self.view.transform = CGAffineTransformConcat(translate, rotate);
whitehawk