How can I make text in a UILabel non-centered?

Posted by Sheehan Alam on Stack Overflow See other posts from Stack Overflow or by Sheehan Alam
Published on 2010-04-21T17:34:01Z Indexed on 2010/04/21 17:53 UTC
Read the original article Hit count: 207

I have a UILabel:

    descriptionLabel = [[UILabel alloc] initWithFrame:CGRectMake(200, 30, 130, 150)];
    [descriptionLabel setFont:[Utils getSystemFontWithSize:14]];
    [descriptionLabel setBackgroundColor:[UIColor clearColor]];
    [descriptionLabel setTextColor:[UIColor whiteColor]];
    descriptionLabel.numberOfLines = 0;
    descriptionLabel.lineBreakMode = UILineBreakModeWordWrap;
    [self addSubview:descriptionLabel];

If the text is only 1 line long it will appear in the middle of the label.

Is there anyway I can have the text display from the top left corner of the label instead of the middle center?

© Stack Overflow or respective owner

Related posts about iphone

Related posts about cocoa-touch