views:

3208

answers:

3

How do I set the title of a UIButton to be left aligned and, how can I show multiple lines of text in a UIButton?

thanks and regards,

raju.

+2  A: 

To set the alignment of a UIButton, if you look in the Button Attributes, there's a place called H. Alignment. Set it to left.

To set a multiline title on a UIButton, I searched on http://www.google.com for "UIButton multiline" and the first result was a discussion on the Apple forums:

http://discussions.apple.com/thread.jspa?messageID=8048670

I've found that creating a label that has multi lines and adding it as a subview of the button works.

Raju, it looks like a lot of your questions get downvoted even though they're not terrible questions. I noticed that you've asked over 30 questions, but never accepted an answer. Perhaps you would generate more goodwill by accepting answers and expending a little more effort with your questions. You can accept answers by clicking on the tick/check mark near the question you think is the best.

nevan
yes dear nevan.. i got it... thanks very much...
Raju
you didn't get it enough to mark some of your questions answered ;-)
Roger Nolan
+15  A: 

Here's the code to do the UIButton alignment in code too: -

[myButton setContentHorizontalAlignment:UIControlContentHorizontalAlignmentLeft];
Ian Kershaw
A: 

Actually, you can set the lineBrakeMode to UILineBreakModeWordWrap or UILineBreakModeCharacterWrap.This brakes the text into multiple lines if necessary.

Marc