/Set the size of the self on the button
[Btn SetFont: [Uifont systemfontsize:14.0]]; This can be used to set the size of the font, but may be removed in the future SDK version of the change method
should use
Btn.titleLabel.font = [Uifont systemfontofsize:14.0];
Btn.contenthorizontalalignment=uicontrolcontenthorizontalalignmentleft;//Set text position, now set to left, default is center
Sometimes we want UIButton's title to align to the left, we set
Btn.textLabel.textAlignment = Uitextalignmentleft
is not useful, we need to set
Btn.contenthorizontalalignment = Uicontrolcontenthorizonalignmentleft;
But the problem comes out again, when the text is pressed to make the border, we can set
Btn.contentedgeinsets = Uiedgeinsetsmake (0,10, 0, 0);
Keeps the text distance of 10 pixels from the border.
=======================================================
Set the color of the font on UIButton UIButton the color of the font, not with:
[Btn.titlelabel Settextcolor:[uicolorblackcolor]];
Btn.titlelabel.textcolor=[uicolor Redcolor];
Instead, use:
[Btn Settitlecolor:[uicolor Blackcolor]forstate:uicontrolstatenormal];
Snail Love Lesson-iOS settings UIButton font size, display position, size