下面的代码工作完美,但是当捏图像质量不好时。我查了很多帖但没找到任何解决方案。这里我没有使用scrollview,想要没有Scrollview的解决方案。请帮助我。
这是我的代码:
-(void)handlePinch:(UIPinchGestureRecognizer *)recognizer
{
UIGestureRecognizerState state = [recognizer state];
CGFloat lastScale = [recognizer scale];
if(state == UIGestureRecognizerStateBegan) {
// Reset the last scale, necessary if there are multiple objects with different scales
lastScale = [recognizer scale];floatValue];
}
if ([recognizer state] == UIGestureRecognizerStateBegan ||
[recognizer state] == UIGestureRecognizerStateChanged) {
CGAffineTransform transform = CGAffineTransformScale([[recognizer view] transform], [recognizer scale], [recognizer scale]);
[recognizer view].transform = transform;
recognizer.scale = 1.0;
}
if ([recognizer state] == UIGestureRecognizerStateEnded){
lastScale = [recognizer scale]; // Store the previous scale factor for the next pinch gesture call
}
}
请帮助我什么,我必须改变,我错了。
答案 0 :(得分:0)
缩放时图像的质量总是会变差,因此如果您想保持初始质量,则需要更大的图像。