views:

256

answers:

2

How would I go about creating a custom UIView that is like the event "bubbles" in iCal for iPhone? I would prefer to not use images, so that they could be in any color.

Thanks!

alt text

A: 

It's basically a rectangle with an arc at each corner. That gives you the shape. The highlight at the top to give it a shine can be done with a gradient drawn on top of the underlying layer. That should let you handle the color of the bubbles without resorting to images.

This SO question has some code to get you pointed in the right direction to draw rectangular shapes with arcs at the corner.

Giao
+2  A: 

You can achieve many effects just playing with CALayer class. Matt Long had a nice blog post about how to use it to make nice UIButtons - may be you'll be able to apply this approach to your needs as well.

Vladimir
Warning: cornerRadius and borderWidth can be quite slow.
rpetrich