Create:
UIButton *hongbao = [UIButton buttonwithtype:uibuttontypecustom];
Custom: Customize button
System: Seems to have an impact on the picture, not the normal picture displayed
Adjust position: These two functions have been adjusted for half a day: Note that the offset refers to the original position, not the distance from the button border, you can set a negative value, that is, moving in the opposite direction
[Hongbao Setimageedgeinsets:uiedgeinsetsmake (-15, 5, 0, 0)]; [Hongbao Settitleedgeinsets:uiedgeinsetsmake (50,-40, 0, 0)];
Parameter meaning: The parameter 1234 represents the pixel moving on the right and bottom left, the attention is on the original basis.
such as Uiedgeinsetsmake (10,0,10,0);
Set text size and color:
Hongbao.titleLabel.font = [Uifont systemfontofsize:14.0]; [Hongbao Settitlecolor:[uicolor Blackcolor]forstate:uicontrolstatenormal];
Event Response:
[Hongbao addtarget:self Action: @selector (Clickedhongbao) Forcontrolevents:uicontroleventtouchdown];
IOS UIButton Use