The Simple Beauty of clearColor

I’ve recently discovered the simple beauty of [UIColor clearColor] used for a background color. Previously I had been doing stuff like:

self.opaque = NO;
self.backgroundColor = nil;
self.clearsContextBeforeDrawing = YES;

But all I really needed to do was:

self.backgroundColor = [UIColor clearColor];

Same transparency, and I’m guessing (hoping?) that it might be a bit more efficient (unless of course, the innards look for clear color and effectively do what I used to).

Hey, even if it’s not more efficient, it’s certainly simpler to type and it seems to have the same effect!

Sadly, this is one thing I didn’t figure out on my own, but rather spied in some other sources, but I wanted to throw it out there for ‘all uh yous’.


1 Comment so far
Leave a comment

Nice trick ;-) Your story has been published at http://www.iPhoneKicks.com :-)

Comment by Raj 01.05.09 @ 1:54 am



Leave a comment
Line and paragraph breaks automatic, e-mail address never displayed, HTML allowed: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

(required)

(required)