Skip to content
jklundell edited this page Jan 10, 2012 · 4 revisions

LCGradientButton is a fairly straightforward extension of UIButton for creating rounded-rect buttons with a color gradient and shadow. It has a provision for using an image instead of the button text, and assorted mechanisms for controlling the color gradient, button border, button radius, etc. And of course the underlying UIButton properties and methods remain available.

To use LCGradientButton, copy LCGradientButton.h & LCGradientButton.m into your project. You'll also need QuartzCore.framework.

The sample project shows how to use LCGradientButton from a xib or programmatically. In the xib, start with a UIButton, change its class to LCGradientButton, adjust your title colors (the sample uses white for all states except disabled, where it uses light gray), and you're off to the races.

If all your buttons are the same color, use setDefaultLowColor:highColor:textColor: before any buttons are instantiated to avoid having to set colors for every button.

Use it freely, but please reciprocate with bug fixes and enhancements.

Clone this wiki locally