我不知道我做错了什么。多次缩放后,我的图像变小了?!?我按如下方式初始化变量:TOTAL_SCALE = 1.0; MIN_SCALE = 1.0;MAX_SCALE = 3.0;
这是我的pinchrecognizermethod:
- (void)pinchDetected:(UIPinchGestureRecognizer *)pinchRecognizer
{
CGFloat scale = pinchRecognizer.scale;
if (TOTAL_SCALE + (scale - 1.0) > MAX_SCALE) {
scale = (MAX_SCALE - TOTAL_SCALE) + 1.0;
TOTAL_SCALE = MAX_SCALE;
imageView.transform = CGAffineTransformScale(imageView.transform, scale, scale);
}
else if(TOTAL_SCALE + (scale - 1.0) < MIN_SCALE){
scale = (TOTAL_SCALE - MIN_SCALE) + 1.0;
TOTAL_SCALE = MIN_SCALE;
imageView.transform = CGAffineTransformScale(imageView.transform, scale, scale);
}
else{
imageView.transform = CGAffineTransformScale(imageView.transform, scale, scale);
TOTAL_SCALE += (scale - 1.0);
}
pinchRecognizer.scale = 1.0;
}
有人能找到我的错误吗?预先感谢!