You can make a difference in the Apple Support Community!

When you sign up with your Apple Account, you can provide valuable feedback to other community members by upvoting helpful replies and User Tips.

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Vertical Text Alignment for UILabel?

For UILabel on the iPhone, there is a property for horizontal text alignment which is textAlignment. But when I have a label that can hold 2 lines (numberOfLines = 2), when the text in the label is only one line, that line centers itself in the entire frame (that can hold two lines), when there are two lines, they both fit fine.

What I'd like to happen is if there is one line in a label that holds two, for the line NOT to be in the middle of the frame but to be pushed to the top of the frame as if there were a second line. In other languages (HTML that I can think of offhand) there is such thing as a verticalTextAlignment with options like top, center, bottom.

So, what am I missing here to make just one line of a UILabel to go to the top of its frame and not center itself in the middle of the frame?

Thanks for any direction.

MacBook Pro, Mac OS X (10.4.10)

Posted on Oct 20, 2008 12:55 PM

Reply
32 replies

Vertical Text Alignment for UILabel?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.