Valentin Shamardin Valentin Shamardin - 1 month ago 23
iOS Question

More button in UILabel like in AppStore any app description

I have a description of myObject and i show it in UILabel. I want to add 'More' button to my

UILabel
if a description is too long. On Github i have found TTTAttributedLabel which allows to use hyperlinks. The question is, is there some special features in
UILabel
or
UITextView
to resolve my issue or i have to use
TTTAttributedLabel
?

Answer

The best option is certainly to use TTTAttributedLabel.

UILabel and UITextView are designed simply for showing static text. There is no method for adding tappable elements.

As an alternative, before I leaned of TTTAttributedLabel I simply placed a UIButton with a custom style over my UILabel. The button was invisible but still responded to taps. This works best for static text though, as the button needs to be placed correctly on the interface to cover the correct part of the text.