My app is placing a button with a custom background image and i doesn’t need a border around it.
I am not sure how to remove the border.
My code is:
UIButton *button = [UIButton buttonWithType:UIButtonTypeRoundedRect];
button.frame=CGRectMake(100, 170, 100,30);
UIImage *cbutton = [UIImage imageNamed:@"pdficon_small.png"];
[button setImage:cbutton forState:UIControlStateNormal];
UIButton *button2 = [UIButton buttonWithType:UIButtonTypeRoundedRect];
[button2 addTarget:self
action:@selector(openWordings:)
forControlEvents:UIControlEventTouchDown];
[button setTag:2];
[self.view addSubview:button];
Thanks in advance.
I’m assuming you mean there is a border arround
button.To remove it replace the line
with this
What you are doing right now is creating a standard RoundedRect button, then placing an image over the top.
using
UIButtonTypeCustomwill create what is essentially a “blank” button, allowing you to use your image.