Thursday, June 04, 2009

iPhone dev Stupidity 13 - Transparent View

* how to cover a transparent/Glass view onto an opaque view?

The trick from Jeff LaMarche's Blog:

"here's the point to remember today: if you need objects below yours to show through parts of your view without using alpha, the backgroundColor property MUST be set to [UIColor clearColor]. This is true even if you do not call drawRect on super.

The other thing you need to do is make sure that the 
opaque property is set to NO. Ordinarily, opaque should be set to YES as an optimization, but that optimization isn't available to us if we want stuff to show through from below."

Messing with alpha does show the view under cover through - but with kind of sick effect: everything is just blurred. If you want to draw something on this glass view, prefer to Jeff's approach.

No comments: