7

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

jansma
  • 1,555
  • 1
  • 14
  • 21

2 Answers2

4

Use anchorPoint property:

self.layer.anchorPoint = CGPointMake(0.0, 0.0);
ArturOlszak
  • 2,585
  • 2
  • 20
  • 20
0

Try to set anchorPoint of layer container!.layer.anchorPoint = CGPoint(x: 0, y: 0)

tuledev
  • 9,747
  • 4
  • 27
  • 47