
The problem was that I was using the backgroundColor property inherited from UIView to identify what color to draw the rounded rectangle. But, and 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 opaqueproperty 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.
My second attempt at a rounded rectangle view was decidedly more rounded:

Because I knew that I would likely have need of a rounded rectangle view in the future, I wrote it generically. And, here it is, may it serve you well:
RoundedRectView.h
//
// RoundedRectView.h
//
// Created by Jeff LaMarche on 11/13/08.
RoundedRectView.m
//
// RoundedRectView.m
//
// Created by Jeff LaMarche on 11/13/08.
0 comments:
Post a Comment