draw line without erasing content

Discussion in 'iPhone/iPad Programming' started by chhoda, Mar 7, 2012.

  1. macrumors 6502

    Joined:
    Oct 25, 2008
    #1
    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
     
  2. Moderator

    dejo

    Staff Member

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

    Joined:
    Jul 29, 2003
    Location:
    Silicon Valley
    #3
    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