Reputation: 309
How can I get the length of the string that a fixed size UILabel can contain?
Upvotes: 1
Views: 196
Reputation: 2794
Refer to this question with my code on how I solved pretty much the same problem: CTFrameGetVisibleStringRange equivalent for iOS programming?
Upvotes: 0
Reputation: 1366
NSString has a method that can return the size (in pixels) for a string with a given font. You could use this to successively trim off characters until it fits. NSString sizeWithFont:minFontSize:actualFontSize:forWidth:lineBreakMode:
Upvotes: 2