I displayed the text in UILabel by using wrap method. Now I want to need to find the how many number of line is there in UILabel.
If there is any possible way to fi
func getHeight(text: NSString, width:CGFloat, font: UIFont) -> CGFloat
{
let rect = text.boundingRect(with: CGSize.init(width: width, height: CGFloat.greatestFiniteMagnitude), options: ([NSStringDrawingOptions.usesLineFragmentOrigin,NSStringDrawingOptions.usesFontLeading]), attributes: [NSFontAttributeName:font], context: nil)
return rect.size.height
}
text: the Label whose height you need to find with the given string
width: the width of UILabel
font: UILabel's font