tags:

views:

5828

answers:

4

I'm in the process of adding custom buttons to my iPhone UI and want to make them have the glassy look from Apple's apps. I have a good default glass image, but I'd hate to have to have a separate image for each tint I want (red, green, blue, etc.).

Is there a way to load a grayscale PNG and adjust it to the color I want? Better yet, is there a way to get Apple's glassy look without having to load custom images at all?

+1  A: 
Matt
+2  A: 

There isn't a one-liner way that I know of, but you might be able to get the desired effect by taking the default grayscale image and compositing it with (i.e. drawing it on top of) a solid color. If you look through the Core Graphics documentation, you can see there are over a dozen different compositing methods (e.g., Color Burn), and some combination of them may produce the effect you want.

benzado
+5  A: 

There's a sample at the always excellent "Cocoa With Love" site: Drawing gloss gradients in CoreGraphic

Alfons