ios - Expand UITextView based on its content -


i'm trying expand uitextview change frame based on content.

the textview should resize height when text inside of gets larger, , smaller when user deletes text.

i tried many answers didn't work.

using following 2 lines best answer question, , solved problem:

expandingtextview.textcontainer.heighttrackstextview = true expandingtextview.isscrollenabled = false 

notes:
expandingtextview: uitextview.
textcontainer: nstextcontainer bounds of text inside expandingtextview.
heighttrackstextview: bool if true, reciever adjust height based on expandingtextview height.

in order expanding work, need disable textview scrolling by:
isscrollenabled = false


Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -