1. Set Title
1 @" Search [ Forstate:uicontrolstatenormal];
2. Set the font
1 // [btn setFont: [Uifont systemfontsize:14.0]]; // This can be used to set the size of the font, but may be removed 2 // should use 3 14.0];
3.Title Alignment
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,00);
Keeps the text distance of 10 pixels from the border.
4. Set Title color
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];
iOS development--set UIButton