I'm creating a custom UIControl that renders it's view via drawRect:
. I want to use the existing backgroundColor property to permit customization via Interface Builder. However, if the backgroundColor is set, by the time drawRect: is called, the entire rectangle has already been filled in. I have opaque = NO and clearsContextBeforeDrawing = YES. If I set the backgroundColor to clearColor then I can render only the parts that I want.
How do I prevent the UIView from filling in the entire rectangle with the backgroundColor automatically?
I should mention that the custom control is placed in Interface Builder so the initWithCoder: method is being used to instantiate the object.
This should certainly possible as if you inherit from UIButton - which uses the backgroundColor - the rectangle has not been filled in.