Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS -- How to scale the UIView with left top point?

I want to fix a point (left top point) and scale (zoom out) the UIView according to the point

like this image

enter image description here

Now I use self.transform = CGAffineTransformMakeScale( 0.7 , 0.7); to scale the UIView , But it only can scale the UIView according to the center point enter image description here

Edit

I try to use set anchorPoint with (0,0) but the view position be wrong

enter image description here

like image 692
jansma Avatar asked Aug 28 '15 07:08

jansma


1 Answers

Use anchorPoint property:

self.layer.anchorPoint = CGPointMake(0.0, 0.0);
like image 188
ArturOlszak Avatar answered Oct 16 '22 04:10

ArturOlszak