Re: Discard all drawing in a UIView
Re: Discard all drawing in a UIView
- Subject: Re: Discard all drawing in a UIView
- From: Manfred Schwind <email@hidden>
- Date: Sun, 25 Jul 2010 21:45:41 +0200
> But, the question still does remain, even if purely for academic
> reasons - can we clear a UIView (in a custom UITableViewCell) in the
> drawRect routine after beginning to draw in it. I have tried playing around
> with two options so far
> 1. CGContextClearRect() - This however clears to a black box and I am not
> able to get it to clear transparently. Setting isOpaque:NO on the view in
> the nib doesn't seem to have an effect.
> 2. Fill with white and then draw. This displays ok when then view is not
> selected. When it is selected, however, it results in blue color surrouding
> the view (with the view remaining white). Filling with blueColor in the
> selected state, doesn't seem to work well either. The blue color is a solid
> blue, while the selection blue surrounding it seems to be some sort of
> gradient
Views are hierarchically stuctured and draw "on top of each other" in the same context.
So if your drawRect is executed, there usually is already something in the context and you can not know what that is.
To "reset" back to the state when your drawRect has started, you may have success by taking a snapshot of the context at the beginning and draw that later again into the context.
Things are probably very different with layer-backed views.
Regards,
Mani
--
http://mani.de - friendly software
@manide
iVolume - listen to music hands-free
LittleSecrets - the encrypted notepad
Sahara - sand in your pocket
Watchdog - baffle the curious
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden