ios - How to round the corners of a button -


i have rectangle image (jpg) , want use fill background of button rounded corner in xcode.

i wrote following:

uibutton *button = [[uibutton buttonwithtype:uibuttontyperoundedrect] retain]; cgrect frame = cgrectmake(x, y, cardwidth, cardheight); button.frame = frame; [button setbackgroundimage:backimage forstate:uicontrolstatenormal]; 

however, button approach doesn't have corners rounded: instead plain rectangle looks original image. how can instead image rounded corner represent button?

thanks!

i think got problem, tried following solution uitextarea , suppose work uibutton well.

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 , if yes communicate.


Comments

Popular posts from this blog

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -