I see some strange behavior in one of my UITableViewCell
s. When setting the font of textLabel
to an italic font ( [UIFont fontWithName:@"Helvetica-BoldOblique" size:17]
), a few pixels at the end get cut off. It's not looking really bad, but I would like to avoid it. Any suggestions?
I'm using the default UITableViewCell
as I only need one UILabel
, so no need to subclass. I tried calling [cell.textLabel sizeToFit]
after setting the font, but it didn't work.
As occulus pointed out, the UILabel
is not wide enough for the italic text. However, because I'm using the default UITableViewCell
, I can not change this. (The textLabel
frame seems to be set at some point unknown to me. When -tableView:willDisplayCell:forRowAtIndexPath:
is called, it's still CGRectZero
.)
So the only solution seems to add a space at the end of my string, as Nick Weaver suggested:
cell.textLabel.text = [NSString stringWithFormat:@"%@ ", cell.textLabel.text];
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