我正在使用 PinchGestureRecognizer 和 RotationGestureRecognizer 都可以正常工作。代码如下:
- (IBAction)pinchDetected:(UIPinchGestureRecognizer *)recognizer {
recognizer.view.transform = CGAffineTransformScale(recognizer.view.transform, recognizer.scale, recognizer.scale);
recognizer.scale = 1;
}
-(IBAction)rotationDetected:(UIRotationGestureRecognizer *)recognizer
{
recognizer.view.transform = CGAffineTransformRotate(recognizer.view.transform, recognizer.rotation);
recognizer.rotation = 0;
}
使用此代码,我可以捏合和旋转我的视图。但是在“RESET”按钮上单击我想将视图的框架设置为捏合或旋转之前的状态。
为此我正在使用
[viewTwo setFrame:CGRectMake(80.0f, 65.0f, 160.0f, 101.0f)];
但我的框架没有设置。
那么我怎样才能像在捏合和缩放之前一样再次设置我的视图框架?