[Help] Drawing app

Discussion in 'iOS Development' started by daconcerror, Oct 11, 2009.

  1. daconcerror

    daconcerror Banned

    Joined:
    Sep 6, 2008
    Messages:
    2,898
    Likes Received:
    0
    Device:
    3G iPod touch
    Ok so ive come up with an idea for a drawing app which includes preset images that you can draw on, but i only want certain parts of it to be able to be drawn on, how could i do this? for example, a house with sky in the background, so you can only draw on the house.
  2. lauNchD

    lauNchD Well-Known Member

    Joined:
    Jan 27, 2008
    Messages:
    1,844
    Likes Received:
    261
    Device:
    iPhone 5 (Black)
    How much do you already know about iPhone OS/Objective-C/Cocoa Touch programming? Are you asking us to write the app for you, or are you asking a technical question (e.g. "Can I somehow apply a mask on my graphics context or my view?")?

    If you want to learn how to make iPhone/iPT apps in general, I suggest you look at some beginner "Hello World" tutorials (not necessarily on iPTF).

    I'm just sort of confused about what your point is hereā€¦
  3. daconcerror

    daconcerror Banned

    Joined:
    Sep 6, 2008
    Messages:
    2,898
    Likes Received:
    0
    Device:
    3G iPod touch
    i know a bit about it, i was just wondering what the easiest way to acheive this was, like seperating the object that can be drawn on and the objects that can't onto different layers or is there a way to specify way to code what can be drawn on and what cant.
  4. lauNchD

    lauNchD Well-Known Member

    Joined:
    Jan 27, 2008
    Messages:
    1,844
    Likes Received:
    261
    Device:
    iPhone 5 (Black)
    I guess the easiest-to-program, but quick'n'dirty approach would be to use layers (not CALayers, but UI[Image]Views on top of each other). Although you can actually draw everywhere, parts of the picture are covered up by the image in front of it. Check out Skylar's drawing app tutorial in the Tutorials section and modify the code to be able to to this (in pseudo-code):

    [OBJC]UIImageView *backgroundView = /* make your image view with the background image, in this case the house */ nil;
    UIView *viewToBeDrawnOn = /* modify Skylar's tutorial to get a transparent view that one can draw on */ nil;
    UIImageView *coverUpper = /* image view to cover up your drawing, in this case the sky */ nil;

    [container addSubview: backgroundView];
    [container addSubview: viewToBeDrawnOn];
    [container addSubview: coverUpper];

    // Release the views if they're not autoreleased[/OBJC]

    If you don't know what some of these terms mean, then please google them!
  5. bddckr

    bddckr Active Member

    Joined:
    Dec 2, 2007
    Messages:
    1,434
    Likes Received:
    18
    Device:
    iPhone 4 (Black)
    [OBJC]-Tags
  6. lauNchD

    lauNchD Well-Known Member

    Joined:
    Jan 27, 2008
    Messages:
    1,844
    Likes Received:
    261
    Device:
    iPhone 5 (Black)
    Totally

    Please Register or Log in to view images


    (I just didn't know iPTF actually had Objective-C syntax highlighting)

Share This Page