UIKIT_EXTERN_CLASS @interface UILabel : UIView
{
....
}
@property(nonatomic) UILineBreakMode lineBreakMode; // default is UILineBreakModeTailTruncation. used for single and multiple lines of text
// this determines the number of lines to draw and what to do when sizeToFit is called. default value is 1 (single line). A value of 0 means no limit
// if the height of the text reaches the # of lines or the height of the view is less than the # of lines allowed, the text will be
// truncated using the line break mode.
@property(nonatomic) NSInteger numberOfLines;
You can set numberOfLines to display on UILabel set numberOfLines attribute.
[label setLineBreakMode:UILineBreakModeTailTruncation];
[label setNumberOfLines:2];
this code will display 2 line of text and if it overflow tail will be changed as "...."
No comments:
Post a Comment