Created
September 27, 2012 23:10
-
-
Save mrsidique/3797007 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NSString *text = @"What\nIs\nUp?"; | |
CGSize constraint = CGSizeMake(CELL_CONTENT_WIDTH - (CELL_CONTENT_MARGIN * 2), 20000.0f); | |
CGSize size = [text sizeWithFont:[UIFont systemFontOfSize:FONT_SIZE] constrainedToSize:constraint lineBreakMode:UILineBreakModeWordWrap]; | |
CGFloat height = MAX(size.height, 44.0f); | |
CGFloat labelHeight = height + (CELL_CONTENT_MARGIN * 2); | |
UILabel *textLabel = [[UILabel alloc]initWithFrame:CGRectMake(15, 5, 250, labelHeight)]; | |
textLabel.font = [UIFont systemFontOfSize:15]; | |
textLabel.text = text; | |
textLabel.numberOfLines = 0; | |
textLabel.lineBreakMode = UILineBreakModeWordWrap; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment