Using the iPhone SDK, how would I go about creating a red "delete" button similar to the one used when deleting contacts on the iPhone?
Screenshot (I'm trying to duplicate the red button at the bottom)
Thanks!
Using the iPhone SDK, how would I go about creating a red "delete" button similar to the one used when deleting contacts on the iPhone?
Screenshot (I'm trying to duplicate the red button at the bottom)
Thanks!
You can create a separate section in your grouped table view, give that section only one row, and set that cell's background image to a red gradient image. You'll have to recreate that image on your own, though.
This question is very close to yours, and contains a couple of ways of generating such a colored button.
Probably the simplest way to do it is to snag this iPhone GUI Photoshop file that contains lots of UI elements in PSD layers, then change the tint of the large button in Photoshop and save it as a PNG.
One advantage of doing it this way is that you can also create versions for button selected and/or highlight state and assign the images to a standard UIButton.
I've done this recently also, and creating this button for it (and some Monotouch example code for any monotouchers):
It has less of a bevel which works better on any background, but doesn't match the iPhone UIGlassButton
exactly.
I think those ones are better (and they look fine on retina display too) :
.png generated from this very nice .psd file : http://www.teehanlax.com/blog/2010/08/12/iphone-4-gui-psd-retina-display/
And then use it as a strechable image for the background of your UIButton
:
UIImage* greenButton = [UIImage imageNamed:@"UIButton_green.png"];
UIImage *newImage = [greenButton stretchableImageWithLeftCapWidth:greenButton.size.width/2 topCapHeight:greenButton.size.height/2];
[callButton setBackgroundImage:newImage forState:UIControlStateNormal];