Reputation: 81
Hi friends i have one requirement that word wrapping on label. Using myLabel.lineBreakMode=NSLineBreakByCharWrapping;
I am able to show the text in label like below
Designation : I am working as iOS
Developer
But i want to show
Designation : I am working as iOS
Developer
Is this possible to achieve above requirement within one label?
Thanks
Upvotes: 0
Views: 1629
Reputation: 10083
I tried it and got it solved. I have attached the screenshot. You just need to do the following:
lines
property of label to 2
.Upvotes: 1
Reputation: 4244
Not possible. UILabel
just renders text according to properties that you defined. If you want to do it ideally then use two UILabel
s. & Place them according to your need.
Upvotes: 0
Reputation: 17595
No, it's not possible with UILabel
, Unless workaround to this. I think, you know how to done manually. But You can't wrap the content like above. Simple answer is you can use two label.
Upvotes: 0
Reputation: 3758
In Xcode, you can design your UILabel
to have 2 lines. Then, you just need to add a new line ("\n"
) after the word "iOS", and center-align everything? If your caption is always the same you can pre-enter it in Xcode. To add a new line, just press alt+Enter
.
Would that be acceptable?
Upvotes: 0