我有一个UISlider
用于缩放imageView
(而不是UIPinchGesture
)并且我正在使用UIRotationGesture
,它们都可以独立工作。缩放而不做旋转手势可以正常工作!但是一旦我执行旋转并且他们放大或缩小imageview
它就会表现得很奇怪,因为它会失去旋转比例。(这就是我的猜测!)我该如何解决这个问题?
好吧,自从几天以来,我对这些数学问题都不太满意,而且我在论坛中搜索也找不到解决方案。请帮助我:)
对于缩放:(这里我不处理变换,因为我不确定)
-(void)scale:(UISlider *)sender
{
float sliderValue = [sender value];
CGRect newFrame = placeRing.frame;
newFrame.size = CGSizeMake(sliderValue, sliderValue);
placeRing.frame = newFrame;
}
对于旋转:
- (void)twoFingersRotate:(UIRotationGestureRecognizer *)recognizer
{
isRotated = TRUE;
if ([recognizer state] == UIGestureRecognizerStateBegan || [recognizer state] == UIGestureRecognizerStateChanged) {
rotation= recognizer.rotation;
rotatedTransform = CGAffineTransformRotate([placeRing transform], [recognizer rotation]);
placeRing.transform = rotatedTransform;
[recognizer setRotation:0];
}
}