MultiLine UILabel
In many cases we need a label with multi line.
For doing this you need to set 2 properties :
1. Number of Lines - 0, it means any number of lines.
2. Line break Mode - WordWrap
CGSize labelsize;
UILabel *TextLabel = [[UILabel alloc] init];
[TextLabel
setNumberOfLines:0];
[TextLabel
setBackgroundColor:[UIColor clearColor]];
NSString *text=@"yourtextString";
[TextLabel
setFont:[UIFont fontWithName:@"Helvetica"size:14]];
labelsize=[text
sizeWithFont:TextLabel.font constrainedToSize:CGSizeMake(268, 2000.0)
lineBreakMode:UILineBreakModeWordWrap];
TextLabel.frame=CGRectMake(10, 24, 268,
labelsize.height);
[cell.contentView
addSubview:TextLabel];
[TextLabel
release];
Comments
Post a Comment