Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 678
Valentin Shamardin Avatar asked Dec 20 '22 04:12

Valentin Shamardin


1 Answers

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.

like image 156
colincameron Avatar answered Dec 24 '22 09:12

colincameron