views:

1108

answers:

3

I'm trying to draw a normal rounded rect UIButton, but without the border. Ideally I'd like to be able to change some setting on the UIButton to disable the border.

My problem is that if I change the button type to "custom", I don't get the nice blue selection gradient (which I want to keep), and I have no idea how to draw it manually.

+1  A: 

Change the button type to custom. There's a dropdown right below that for "Default", "Highlighted", "Selected", etc. Make a blue gradient, set it as the image for the "Highlighted State Configuration". That should give you the blue gradient when you highlight it. If you want it when it's selected, use the "Selected" configuration.

saramah
Ideally I'd like to just use the built-in blue gradient and keep the rounded-rect shape.
Dave DeLong
don't think you can — if you want the rounded rect shape, shape the gradient correctly and your custom images like the rounded rect. unfortunately, i think you're going to have to fake it instead of using apple's shininess.
saramah
+1  A: 

I've used a UISegmentedControl with only one segment for this. You can use tintColor you get a nice gradient. The event connections are slightly different but not a big deal.

This answer provides more detail.

progrmr
I ended up going with this. It doesn't provide the solid white background, and the segmented control still has the border, but it was close enough to what I was trying to do.
Dave DeLong
A: 

You can use custom type of UIButton. And set the appropriate image as a background of the UIButton.

yakub_moriss
Yes, I know I can do this (I say so in the question). My question is if I can remove the border *without* making it a custom button.
Dave DeLong