objective c - How to change the shape of button in ios? -


i want make roundrectangular button applied following code not working. plz me enter image description here

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

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -