重置UIImageView捏合和旋转手势属性

时间:2017-12-21 04:22:56

标签: ios objective-c uiimageview uigesturerecognizer

步骤:1 new Handler().postDelayed(new Runnable() { @Override public void run() { File file = new File("/sdcard/Pictures/" +myFileName); long size = file.length(); if (size == 0){ if (file.delete()) { Log.d(TAG, "delete success"); } else { Log.d(TAG, "fail delete"); } } } }, 20000); }

// Add Gestures

步骤:2

旋转和缩放图像。

步骤:3

UIRotationGestureRecognizer *rotateGesture = [[UIRotationGestureRecognizer alloc] initWithTarget:self action:@selector(rotationGestureDetected:)];

UIGestureRecognizerState state = [recognizer state];

        if (state == UIGestureRecognizerStateBegan || state == UIGestureRecognizerStateChanged)
        {
            CGFloat rotation = [recognizer rotation];
            [recognizer.view setTransform:CGAffineTransformRotate(recognizer.view.transform, rotation)];
            [recognizer setRotation:0];
        }

结果:图像已拉伸

enter image description here

0 个答案:

没有答案