I need to scale a view with UIPinchGestureRecognizer but without CGAffineTransform, so how to change this code to do it without CGAffineTransform?
- (IBAction)zoomma:(UIGestureRecognizer *)sender {
CGFloat factor = [(UIPinchGestureRecognizer *)sender scale];
if (factor > 1) {
self.sgungaView.transform = CGAffineTransformMakeScale(lastScaleFactor + (factor-1), lastScaleFactor + (factor-1));
} else {
self.sgungaView.transform = CGAffineTransformMakeScale(lastScaleFactor * factor, lastScaleFactor * factor);
}
if (sender.state == UIGestureRecognizerStateEnded) {
if (factor > 1) {
lastScaleFactor += (factor-1);
} else {
lastScaleFactor *= factor;
}
}
}
Edit:
Not a masterpiece but this works
- (void)zoomma:(UIGestureRecognizer *)sender {
CGFloat factor = [(UIPinchGestureRecognizer *)sender scale];
if (factor > 1) {
float enlarge = lastScaleFactor + (factor-1);
[self.sgungaView setBounds:CGRectMake(0, 0, self.sgungaView.bounds.size.height + enlarge, self.sgungaView.bounds.size.height + enlarge)];
} else {
float stringi = lastScaleFactor * factor;
[self.sgungaView setBounds:CGRectMake(0, 0, self.sgungaView.bounds.size.height - stringi, self.sgungaView.bounds.size.height - stringi)];
}
if (sender.state == UIGestureRecognizerStateEnded) {
if (factor > 1) {
lastScaleFactor += (factor-1);
} else {
lastScaleFactor *= factor;
}
}
}
there's a better way?