I am looking to implement a "Read more" button that will expand the UITextView so that someone can read the whole text if they wish. I haven't managed to find an easy way to achieve this yet. I tried to "play" with the container's height but it doesn't give me the desired results. I would really appreciate any ideas.
I would suggest you the ilyapuchka ReadMoreTextView library which is on this link. It is the easiest way to achieve this and it is retty lightweight.
You can install it with CocoaPods, just implement pod 'ReadMoreTextView'
into the podfile and you can use it likie this:
let textView = ReadMoreTextView()
textView.text = "Lorem ipsum dolor ..."
textView.shouldTrim = true
textView.maximumNumberOfLines = 3
textView.trimText = "Read more"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With