7

I want to show more button at the end of the text or below if there isn't enough space. I don't understand how Apple developers did this? Please answer in swift. After clicking on more button i want to show all the text. change the button to less.

Thanks in advance.

enter image description here

Anirudha Mahale
  • 2,526
  • 3
  • 37
  • 57
  • Possible duplicate of [Add "...Read More" to the end of UILabel](http://stackoverflow.com/questions/32309247/add-read-more-to-the-end-of-uilabel) – Ahmad F Nov 14 '16 at 07:02
  • @AhmadF, bro could you please take a look my question https://stackoverflow.com/questions/44966983/how-to-set-label-height-for-auto-adjust-in-read-more-less-with-swift-3 ? – May Phyu Jul 07 '17 at 09:24

2 Answers2

7

Here's a great CocoaPod for the functionality you're looking for.

https://github.com/ilyapuchka/ReadMoreTextView

This will allow you to set a maximum number of lines and customise the text append to the end of the trimmed text. You can change the font and color since it is an NSAttributedString.

Callam
  • 11,409
  • 2
  • 34
  • 32
  • Thanks for the answer, I wanted to do manual implementation so I was asking for some code. – Anirudha Mahale Nov 14 '16 at 07:11
  • @AnirudhaMahale, bro could you please take a look to my question https://stackoverflow.com/questions/44966983/how-to-set-label-height-for-auto-adjust-in-read-more-less-with-swift-3 ? – May Phyu Jul 07 '17 at 09:24
-5

If you add more than 4-5 view controllers to a TabBar Controller, either in storyboard or programmatically(adding array of controllers to a tabar controller), it automatically show a more item as a tabar item in TabBar.

KGen
  • 50
  • 3