I am trying to create a Read More button at the end of my tag. I want it to display 3 lines by default. I code in fast non objective c. Only when the user clicks on the read part of the label does the label expand. It should look and work just like on instagram, except Instagram, it is in the tableview cell. My shortcut and the Read More button will scroll. I managed to get the expanding and contracting part to work by adjusting the number of label line properties.
if descriptionLabel.numberOfLines == 0{
descriptionLabel.numberOfLines = 3
}else {
descriptionLabel.numberOfLines = 0
}
descriptionLabel.lineBreakMode = NSLineBreakMode.byWordWrapping
I'm having trouble putting "... more" at the end of the shortcut and cutting out the text in the right place. I looked at other people's answers to similar questions, but nothing is working properly.
I can put a button above the last line of text to make the part of the shortcut more accessible with the click of a button is also not a problem. The problem I am facing is truncating the text in the right place and placing the larger text in the right place so that it appears.
I also want the read more button to appear only when necessary. I do not want this to appear when there are only 1-3 lines of text. I have problems too.
I cannot use this https://github.com/apploft/ExpandableLabel because it does not support scrollviews only tableviews.
a quick solution here did not work: Add "... More" to the end of UILabel . This crashed the application.
, read more . , tableview!