I created a UILabel and set lineBreakMode to NSLineBreakByWordWrapping, but sometimes one word is splitted into two lines.
My codes are like belows
_sentenceLabel.textAlignment = UITextAlignmentCenter;
if (_sentenceLabel.bounds.size.width > self.bounds.size.width - 100) {
CGSize size = [_info.sentence sizeWithFont:sentenceFont
constrainedToSize:CGSizeMake(self.bounds.size.width - 100, 1000)];
_sentenceLabel.frame = CGRectMake(0, 0, size.width, size.height);
_sentenceLabel.numberOfLines = 0;
_sentenceLabel.lineBreakMode = NSLineBreakByWordWrapping;
}
When font name is @"Gill Sans", the line break is not right. (The word "results" is splitted into two lines)
When I change to other font, it works again. It is weird.
Thanks for any help.
This is happening with korean characters too, font AppleSDGothicNeo-Bold and others. In an unique label with latin and korean words, for the latin ones the word wrapping is working but it is not for the Korean ones.
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