How can I use pinch zoom(UIPinchGestureRecognizer) to change width of a UITextView?

后端 未结 4 1659
陌清茗
陌清茗 2020-12-25 09:52

I can get the UIPinchGestureRecognizer handler to work with scaling an object but I don\'t want to scale I want to change the size. For example I have a

4条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-25 10:40

    I think what you want to do is just multiplying the width of your textView's frame with the gesture recognizer's scale:

    CGFloat scale = gestureRecognizer.scale;
    CGRect newFrame = textView.frame;
    newFrame.size = CGSizeMake(scale*newFrame.size.width, newFrame.size.height);
    textView.frame = newFrame;
    

    Or isn't this what you mean?

提交回复
热议问题