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

java - WARN : org.springframework.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/board/] in DispatcherServlet with name 'appServlet' -

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

android - How to create dynamically Fragment pager adapter -