Settings for the relative seat of the UIButton content, title, background in the button container in iOS
UIButton *button = [Type of UIButton Buttonwithtype:uibuttontypecustom];//button
Button.frame = CGRectMake (100,90, n); frame of//button
Button.backgroundcolor = [background color of Uicolor Cyancolor];//button
[Button setbackgroundimage:[uiimage imagenamed:@ "Man_64.png"] forstate:uicontrolstatenormal];
There are three settings for edgeinsets in UIButton: Contentedgeinsets, Titleedgeinsets, imageedgeinsets
[Button Setimage:[uiimage imagenamed:@ "[email protected]"] forstate:uicontrolstatenormal];//add image to button
Button.imageedgeinsets = Uiedgeinsetsmake (5,13,21,button.titlelabel.bounds.size.width);//sets the position of the image on the button (top , left, next bottom, right) Here you can write negative values, write to 5, then image moves 5 pixels above
[Button settitle:@ "Home" forstate:uicontrolstatenormal];//set the button's title
Button.titleLabel.font = [Uifont systemfontofsize:16];//title font size
Button.titleLabel.textAlignment = nstextalignmentcenter;//Sets the font center of the title
[Button Settitlecolor:[uicolor Whitecolor] forstate:uicontrolstatenormal];//set title in normal case white font
[Button Settitlecolor:[uicolor Graycolor] forstate:uicontrolstatehighlighted];//set title Gray font when button is selected
Button.titleedgeinsets = Uiedgeinsetsmake (-button.titlelabel.bounds.size.width-50, 0, 0);// Set the title position on the button (top, left, bottom bottom, right)
[Button Setcontentedgeinsets:uiedgeinsetsmake (70, 0, 0, 0)];//
Button.contenthorizontalalignment = uicontrolcontenthorizontalalignmentcenter;//The contents of the button are centered horizontally ... Setting content is changed with title and image
[Button addtarget:self action: @selector (TAP) forcontrolevents:uicontroleventtouchupinside];
[Self.view Addsubview:button];