Autoexpand UITextView height dynamically in ios

后端 未结 4 1029
醉话见心
醉话见心 2021-01-17 00:03

I have a simple textView who\'s data gets populated dynamically. I want to resize the height of the textview once the data is populated so that I don\'t see a vertical scrol

4条回答
  •  太阳男子
    2021-01-17 00:57

    Below is the trick I always use...

    1. Create one fake UITextView
    2. Put data into it
    3. Call sizeToFit
    4. Hide this textview
    5. Set actual textview height based on this fake uitextview...

    Done....

提交回复
热议问题