UIImageView在缩放时会离开屏幕

时间:2012-11-01 13:52:02

标签: iphone uiimageview zoom scale

我有放大UIImageView的当前代码:

- (void)handlePinch:(UIPinchGestureRecognizer *)pinchGestureRecognizer
{
    mCurrentScale += [pinchGestureRecognizer scale] - mLastScale;
    mLastScale = [pinchGestureRecognizer scale];

    if (pinchGestureRecognizer.state == UIGestureRecognizerStateEnded)
    {
        mLastScale = 1.0;

    }

    CGAffineTransform currentTransform = CGAffineTransformIdentity;
    CGAffineTransform newTransform = CGAffineTransformScale(currentTransform, mCurrentScale, mCurrentScale);
    thumbView.transform = newTransform;
}

图像位于右上角,如果我将一半的图像边缘放大到视图之外,如何以这种方式放大图像,使其保持在右上角并正确显示?

1 个答案:

答案 0 :(得分:0)

使用CGAffineTransformTranslate在缩放时向左移动?