The easiest way to implement the Read More button to deploy a UITextView in iOS Swift 2?

I am looking for an implementation of the Read More button that will extend the UITextView so that someone can read all the text if they want. I have not yet been able to find a simple way to achieve this. I tried to “play” with the height of the container, but this does not give me the desired results. I would really appreciate any ideas.

+4
source share
1 answer

I would suggest you the ilyapuchka ReadMoreTextView library , which is located at this link. This is the easiest way to achieve this, and it is light weight.

You can install it using CocoaPods, just pod 'ReadMoreTextView'put it into the podfile, and you can use it:

let textView = ReadMoreTextView()

textView.text = "Lorem ipsum dolor ..."

textView.shouldTrim = true
textView.maximumNumberOfLines = 3
textView.trimText = "Read more"
+6
source

All Articles