array of images for onscreen dragging

Discussion in 'iPhone/iPad Programming' started by stirfie, Feb 11, 2012.

  1. macrumors newbie


    Feb 11, 2012
    Western Australia
    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

  2. macrumors 6502

    Aug 14, 2008
    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



    Staff Member

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


    Feb 11, 2012
    Western Australia
    Thanks for the replies guys.

    Thanks dejo, I suppose RTFM applies here :)

    Regards Paul

Share This Page