using this function, whenever I have a '\n' character in the text of my UITextView, it doesn't resize text size properly to fit the specified frame size, but when i remove the '\n' character, it works perfect does anyone know why?
extension UITextView{
open override func didMoveToSuperview() {
var defaultFontSize = CGFloat(44.0)
self.font = UIFont(name: (self.font?.fontName)!, size: defaultFontSize)
if (self.contentSize.height > self.frame.size.height) {
var fontIncrement = CGFloat(1.0)
while (self.contentSize.height > self.frame.size.height) {
print(defaultFontSize - fontIncrement)
self.font = UIFont(name: (self.font?.fontName)!, size: defaultFontSize - fontIncrement)
fontIncrement += 1.0
}
}
}
}