开发者

Changing text layout in a UILabel - Specifically where it starts from

开发者 https://www.devze.com 2023-03-10 17:15 出处:网络
I have this problem with one of my UILabels, I would like to have the text that it displays begin being drawn at the top left of the label rather than the middle left.

I have this problem with one of my UILabels, I would like to have the text that it displays begin being drawn at the top left of the label rather than the middle left.

Current scre开发者_C百科en:

Changing text layout in a UILabel - Specifically where it starts from

As you can see the word "Description" in the label appears in the centre and to the left of the label. I would like it to start at the top-left instead. How do I implement this either programatically or in IB?

Thanks,

Jack


I'd assume that you're eventually going to put a description in, in which case it would be easier in the long run to simply make the UILabel for "Description" one line high, and put it at the top. Then, just add another multiline UILabel for the actual content. Having separate UILabels will make things simpler later.


Changing the Description label to a UITextView pretty much solved my problem. It allowed for multiple lines of text and was much simpler to implement. Also looked a little prettier.

Thanks for your help, particularly Daniel.

Jack

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号