PDA

View Full Version : draw line without erasing content




chhoda
Mar 7, 2012, 06:52 AM
hi all,

i have some content drawn already in the view. i am trying to draw a line on it for touchesmoved. the problem is when it draws using drawrect method, it erases the entire content, how can i save previous context and only draw this line ?

regards



dejo
Mar 7, 2012, 08:33 AM
Perhaps you should relate to us how you are achieving this line-drawing. Maybe even provide the code that does it.

firewood
Mar 7, 2012, 11:47 AM
If you want to save anything in a drawing context, you have to create the context yourself, perhaps from a bitmap that you have allocated.

UIViews are not guaranteed to save anything drawn into in their drawing context once that drawing is sent to the display. So don't use a UIView for drawing if you want to draw over persistant content.