I need to add read more
at the end of the 3rd line in label.
like this i need:
Note: i have tried this answer Add "...Read More" to the end of UILabel but here read more action is not working and expand collapse also not working.. so tried like below
Actually i need to show description in label.. here if the description if more then 3 lines then i need to show read more
at end of the 3rd line and need to expand the label with remaining text..
code: with this code i can expand the label if more than 3 lines but i need to show read more
at end of the third line
override func viewDidLoad() {
super.viewDidLoad()
despLbl.text = publicProGenInfo?.result?.user?.description
despLbl.numberOfLines = 3//despLbl.maxNumberOfLines//3
let tap:UITapGestureRecognizer = UITapGestureRecognizer(target: self, action: #selector(self.labelAction(gesture:)))
despLbl.addGestureRecognizer(tap)
despLbl.isUserInteractionEnabled = true
tap.delegate = self
}
@objc func labelAction(gesture: UITapGestureRecognizer)
{
if despLbl.numberOfLines == 3 {
despLbl.numberOfLines = despLbl.maxNumberOfLines
} else {
despLbl.numberOfLines = 3
}
}
o/p: getting like this.. here after 3rd line how to add read more
text... please do guide