What factors affect the flow of text inside a text field. The width of my text is 160 pixels, and I calculated the width of the incoming text using the code below, and it turns out to be 157 px, but this text is wrapped in 3 lines ... Why is that?
CGSize size = [myText sizeWithFont:textViewFont
constrainedToSize:textView.frame.size
lineBreakMode:UILineBreakModeWordWrap];
CGFloat textWidth = size.width;
I was thinking of splitting the width of the text with the width of the textview to get the number of lines. But the calculation returns me 1, while in the simulator you can see 3 lines.
source
share