I have a rectangle image (jpg) and want to use it to fill the background of a button with rounded corner in xcode.
I wrote the following:
UIButton *button = [[UIButton buttonWithType:UIButtonTypeRoundedRect] retain];
CGRect frame = CGRectMake(x, y, cardWidth, cardHeight);
button.frame = frame;
[button setBackgroundImage:backImage forState:UIControlStateNormal];
I think I got your problem, I tried the following solution with the UITextArea and I suppose this will work with UIButton as well.
first of all import this in your .m file -
and then in your
loadView method add following lines
yourButton.layer.cornerRadius = 10; // this value vary as per your desire yourButton.clipsToBounds = YES;
Hope this works for you and if yes do communicate.