Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rounded Rect UIButton without the border

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.

like image 547
Dave DeLong Avatar asked Mar 31 '10 21:03

Dave DeLong


2 Answers

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.

like image 52
saramah Avatar answered Oct 31 '22 06:10

saramah


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.

like image 2
progrmr Avatar answered Oct 31 '22 07:10

progrmr