我在UIPinchGestureRecognizer
上添加了UIRotationGestureRecognizer
和UITextView
。收缩或旋转时,将更改UITextView
对象的transform属性。但是,如果我将其旋转一定角度并放大到一定比例,文本将突然消失。
如果我继续旋转它,文本可能会以某种角度重新出现。
有什么办法可以解决失踪案吗?
这就是我使用手势识别器方法所做的事情。
- (void)onPinchtextView:(UIPinchGestureRecognizer *)pinchGestureRecognizer {
CGFloat scale = pinchGestureRecognizer.scale;
if (pinchGestureRecognizer.state == UIGestureRecognizerStateChanged || pinchGestureRecognizer.state == UIGestureRecognizerStateBegan) {
self.textView.transform = CGAffineTransformScale(self.textView.transform, scale, scale);
pinchGestureRecognizer.scale = 1.f;
}
- (void)onRotatetextView:(UIRotationGestureRecognizer *)rotateGestureRecognizer {
CGFloat rotation = rotateGestureRecognizer.rotation;
if (rotateGestureRecognizer.state == UIGestureRecognizerStateChanged || rotateGestureRecognizer.state == UIGestureRecognizerStateBegan) {
self.textView.transform = CGAffineTransformRotate(self.textView.transform, rotation);
[rotateGestureRecognizer setRotation:0];
}
}