3

I have a UITextView that I am resizing using a UIPinchGestureRecognizer:

@IBAction func handlePinch(recognizer : UIPinchGestureRecognizer) {
    if let view = recognizer.view {
      view.transform = CGAffineTransformScale(view.transform,
        recognizer.scale, recognizer.scale)

        recognizer.scale = 1
    }
        self.textView.textContainer.size = self.textView.bounds.size
  }

All my text is displayed until I resize the UITextView using the above func. Once I resize smaller, the textContainer is smaller in both height and width. I have tried to change bounds.size to frame.size. I have autoresizesubview = true already. Can't figure this one out...I have tried almost everything.

Alexey Pichukov
  • 3,377
  • 2
  • 19
  • 22
B. Wolf
  • 81
  • 1
  • 5
  • 1
    Is the gesture recognizer added to the UITextView or another view? Also, the last line isn't needed since the bounds will not change. – Craig Siemens Nov 10 '15 at 18:24
  • Yes, the gesture recognizer is added to the UITextView. Also, I tried it without the last line and you are correct, it is not needed. Thanks! textContainer still resizing though. – B. Wolf Nov 10 '15 at 18:45
  • I figured out half of my problem. I set myTextView.clipstobounds = false in my viewDidLoad. This fixed my height of my textContainer from being cut off. However, it still cuts off my width. – B. Wolf Nov 10 '15 at 19:26
  • @B.Wolf what was the solution for this? – ahoang Feb 01 '19 at 07:58

0 Answers0