1

The following block of code was working in iOS7 and 8 but when I updated to iOS9 the number of lines is always returning as 0.

Is there anything obvious that needs to change>

 NSInteger lineCount = 0;
CGSize textSize = CGSizeMake(self.messageLabel.frame.size.width, MAXFLOAT);
int rHeight = (int)lroundf([self.messageLabel sizeThatFits:textSize].height);
int charSize = (int)lroundf(self.messageLabel.font.leading);
lineCount = rHeight/charSize;
NSLog(@"No of lines: %li",(long)lineCount);
DevC
  • 6,982
  • 9
  • 45
  • 80

0 Answers0