UILabel has a label truncation function using various truncation methods (UILineBreakMode). NSString UIKit Additions has similar functionality for drawing strings.
However, I did not find access to the actual truncated string. Is there any other way to get a truncated string based on (graphic) width for a given font?
I would like to have a category in NSString using this method:
-(NSString*)stringByTruncatingStringWithFont:(UIFont *)font forWidth:(CGFloat)width lineBreakMode:(UILineBreakMode)lineBreakMode
ios objective-c iphone cocoa-touch nsstring
Ortwin gentz
source share