draw line without erasing content

Discussion in 'iOS Programming' started by chhoda, Mar 7, 2012.

  1. macrumors 6502

    Oct 25, 2008
    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 ?

  2. Moderator


    Staff Member

    Sep 2, 2004
    The Centennial State
    Perhaps you should relate to us how you are achieving this line-drawing. Maybe even provide the code that does it.
  3. macrumors 604

    Jul 29, 2003
    Silicon Valley
    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.

Share This Page