views:

273

answers:

1

Hi guys,

I have a view (MKMapView) and on it I've a transparent view on which I draw different things. Now I would like to give the user the option to erase things so that the "background view" (the mapView) will be seen in the erased places. Do you think it's possible?

Thanks

A: 

You can just set alpha of this view to 0.0f. And if you have to erase, you can call [self setNeedsToDisplay]. This will redraw your quartz elements. There you can add some flag, that will allow you to draw smth only when it needs.

Morion
I already thought about it. Where am I to put this "flog"? Will it be on each pixel? There is an app called ShowGirl. There you have a layer that hides a picture. The user touches areas and they get revealed. I would like to achieve that effect.
Alex1987
No, not on each pixel. Each time you call [self setNeedsToDisplay]; method, the drawRect: method of your class is called. It will clean all previous data and draw it from scratch.
Morion
But you need to tell drawRect where to draw and where not to. Suppose that I have a black circle. Then the user moves with its fingers and erases parts of it. How drawRect know not to draw anything where the user erased?
Alex1987