No. Just the graphical context is restored (graphical engine state machine), not what the engine has produced.
If I save and restore the CurrentGraphicsContext, will that revert my drawing back to original state?
Domanda
I have an iPad app where I draw a grid of dates along the x axis and times down the y axis. I then draw colored bars (using CGContext methods) in specific sections of this grid (see image).
If I change the data that is used to draw the bars, the old bars are still visible and the new bars are not. If I use -CGContextSaveGState and -CGContextSaveGState, will that "clear" the old data so the grid is as it was originally without any bars?
Soluzione 2
Altri suggerimenti
I think Vincent answered your question, but what you need to do now is to redraw all the bars from scratch on the background grid. Call setNeedsDisplay
for the view that draws the background and the bars when the bar parameters change. Your drawRect
should then recreate the grid and bars.