array of images for onscreen dragging

Discussion in 'iOS Programming' started by stirfie, Feb 11, 2012.

  1. macrumors newbie

    stirfie

    Joined:
    Feb 11, 2012
    Location:
    Western Australia
    #1
    Hi All

    I'm just after some advice. I am working on an app that has images on the screen that a user can drag around.

    I have come from a realbasic background, so my approach is as follows:

    Created an object (dragObject) with properties ( uiimage, cgpoint(for the coordinates) and cgsize ).
    Created an array (dragArray) of these properties

    Subclassed the UIView that has a property UIImage called mainImage.

    When I handle the drag, mainImage gets redrawn using dragArray in a for loop.

    The UIView then gets redrawn in drawrect with mainImage.

    Is this the best approach, or should I have an array of UIImageViews, where all the images on screen are handled by their own image view.

    I am new to IOS so just some general advice would be appreciated

    Regards
    Paul
     
  2. macrumors 6502

    Joined:
    Aug 14, 2008
    #2
    I've been using a uiwebview in the past with simple html/js to move pictures around. Could be an alternative for you unless for some reason you can't use a webview for your particular app.
     
  3. dejo, Feb 12, 2012
    Last edited: Feb 13, 2012

    Moderator

    dejo

    Staff Member

    Joined:
    Sep 2, 2004
    Location:
    The Centennial State
    #3
    UIImageView has a frame property with contains a CGPoint and CGSize. So, your dragObject seems to be duplicating it.
     
  4. thread starter macrumors newbie

    stirfie

    Joined:
    Feb 11, 2012
    Location:
    Western Australia
    #4
    Thanks for the replies guys.


    Thanks dejo, I suppose RTFM applies here :)


    Regards Paul
     

Share This Page