objective c - How to change the shape of button in ios? -
i want make roundrectangular button applied following code not working. plz me
login = [uibutton buttonwithtype:uibuttontyperoundedrect]; cgfloat xbuttonpadding = cgrectgetminx(password.frame); cgfloat ybuttonpadding = cgrectgetmaxy(password.frame) + xpadding; cgfloat widthloginbutton = cgrectgetwidth(self.view.frame) - widthpassword; cgfloat heightloginbutton = cgrectgetheight(username.frame) +10; login.frame= cgrectmake(xbuttonpadding, ybuttonpadding, widthloginbutton, heightloginbutton); login.backgroundcolor = [uicolor bluecolor]; [login settitle:@"login" forstate:uicontrolstatenormal]; [login addtarget:self action:@selector(show:) forcontrolevents:uicontroleventtouchupinside];
first of import in .m file -
#import <quartzcore/quartzcore.h>
and in loadview method add following lines
yourbutton.layer.cornerradius = 10; // value vary per desire yourbutton.clipstobounds = yes;
hope works you
Comments
Post a Comment