I am using UIGestureRecognizer
to make the pinch action and I need to change the anchor point to resize to the correct point of my UIImage
. After I change the anchor point, the image moves a little bit, and I need to put it back to the origin. Here is what i am doing:
override func viewWillAppear(animated: Bool) {
super.viewWillAppear(animated)
imageThinkCreatively.layer.anchorPoint = CGPointMake(0.6, 0.7)
imageThinkCreatively.frame = CGRectMake(0, 0, 200.0, 200.0)
imageThinkCreatively.layoutIfNeeded()
}
@IBAction func scaleImage(sender: UIPinchGestureRecognizer) {
sender.view!.transform = CGAffineTransformScale(sender.view!.transform, sender.scale, sender.scale)
sender.scale = 1
}
But the image does not change the origin or the size... What am i doing wrong?