views:

8440

answers:

1

If I have two UIColors, what's the best way to draw an even gradient between them over an arbitrarily-sized area?

I am guessing you would create a UIView subclass and use the CG drawing methods in the drawRect method. I just don't know which ones, or if there are any pitfalls to watch out for, like performance. Has anyone done this?

+11  A: 

You'll want to use CGGradient, see the iPhone Dev Center document on Gradients.

Ben Gottlieb
Nice, thanks. Wonder how I missed that...
Mike McMaster
Great effort there, linking to the docs.
Max Howell