2
votes

I have a trunk of text in an UILabel

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum eget tortor porttitor, aliquam magna bibendum...show more

When I click on "show more", it should expand

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum eget tortor porttitor, aliquam magna bibendum, venenatis nunc. Aenean commodo nisl vel semper blandit. Vivamus rhoncus, lorem sed mollis tristique, dolor velit molestie ligula, eget semper leo augue eu urna. show less

How shall I implemented this?

2
where have you been stuck?holex

2 Answers

1
votes

You can also use UITapGestureRecognizer and detect the tap location in the NSAttributedString of a UILabel. Check out my answer here. You don't even need to subclass anything.

0
votes

You can try TTTAttributedLabel and truncationTokenString to add show more, for adding show less you can use links from TTTAttributedLabel

Possible duplication of More button in UILabel like in AppStore any app description