Is there possible to resize text to fi my UITextView? I tried something like:
if (_myTextView.contentSize.height > _myTextView.frame.size.height)
{
_myTextView.font = [_myTextView.font fontWithSize:25];
}
This resizing text very well, but i have some lines of text which are longer and then i need to decrease my font size.
Try the same idea iteratively ...
CGFloat fontSize = 25.0;
_myTextView.font = [_myTextView.font fontWithSize:fontSize];
while (_myTextView.contentSize.height > _myTextView.frame.size.height && fontSize > 8.0) {
fontSize -= 1.0;
_myTextView.font = [_myTextView.font fontWithSize:fontSize];
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With