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,605
  • 1
  • 15
  • 22

2 Answers2

4

Use anchorPoint property:

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

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

tuledev
  • 10,177
  • 4
  • 29
  • 49