views:

21

answers:

0

Hi
Trying to both translate(x,y) and scale some images when my application rotates. It seems there are more than 1 way to do this.

I can use 'setValue forKeyPath' method to transform a view's layer

 [containerView.layer setValue:[NSNumber numberWithFloat: .7] forKeyPath: @"transform.scale.x"]; 
 [containerView.layer setValue:[NSNumber numberWithFloat: .7] forKeyPath: @"transform.scale.y"]

or I can transform a view directly using CGAffineTransform transform.

 CGAffineTransform transform = CGAffineTransformMakeScale(.7, .7);
 containerView.transform = transform;

Can anyone tell me what the difference is? Is there a 'best practice' to use when both scaiing and translating?