Large Text Being Cut Off in UITextView That is Inside UIScrollView

后端 未结 17 1710
挽巷
挽巷 2020-11-29 02:03

I\'m having a serious problem that I just can\'t seem to fix and it\'s driving me insane for the last two days. I have searched far and wide and I can\'t find a solution, e

17条回答
  •  忘掉有多难
    2020-11-29 02:40

    We had an issue like this with the rollout of iOS7. When we called setText which added a new line (or lines) to our UITextView, the textview wasn't using the correct new height for its redrawing. The setNeedsDisplay, setNeedsLayout, redrawing layers, redrawing the entire view, etc all didn't work. Finally we forced a loss and gain of focus:

    [textView resignFirstResponder];
    [textView becomeFirstResponder];
    

    This forced the height recalculation and correct redraw. Thankfully it does not cause the keyboard to pop out and in, but it's worth regression testing that on any iOS versions your app supports.

提交回复
热议问题