Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

caldwelljason

macrumors member
Original poster
Jul 9, 2008
44
2
I need a red "Delete" button at the bottom of my view, like the calendar has when editing an event.

I'm trying to figure out how to get the nice, rounded, gradient-filled red button as the background. Does that exist anywhere that I have access to? Is it somehow a style of a button? I can't seem to find it.

Or do I need to create an image and set it as the background image for my button?
 
you could...
a) create a red button shaped image that says "delete"
b) set the button to have no frame.
c) set the buttons' image to the image.
 
Solution

Hope this helps someone else!

I ended creating a default button image and a pressed button image. Then I create a UIImage* using stretchableImageWithLeftCapWidth to stretch the image across the entire button. Having created the UIImage*, I set that as the background on the button with

[myButton setBackgroundImage:myPressedImage forState:UIControlStateHighlighted];

and

[myButton setBackgroundImage:mydefaultImage forState:UIControlStateNormal];

Works like a charm. :cool:

I actually created a factory class that creates the buttons for me in a single method call so that I can control the look of all the buttons in the app in a single place.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.