The Simple Beauty of clearColor

by Ed on October 22, 2008

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… read it below or add one }

Raj January 5, 2009 at 1:54 am

Nice trick 😉 Your story has been published at 🙂


Leave a Comment

Previous post:

Next post: