Friday, January 28, 2011

how to set the title as left alignment in the UIButton in iPhone ?

Set the contentHorizontalAlignment:

btn.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft;

You might also want to adjust the content left inset otherwise the
text will touch the left border:

btn.contentEdgeInsets = UIEdgeInsetsMake(0, 2, 0, 0);

No comments:

Post a Comment