PDA

View Full Version : array of images for onscreen dragging




stirfie
Feb 11, 2012, 07:27 PM
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



Danneman101
Feb 12, 2012, 07:37 AM
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.

dejo
Feb 12, 2012, 12:00 PM
UIImageView has a frame property with contains a CGPoint and CGSize. So, your dragObject seems to be duplicating it.

stirfie
Feb 12, 2012, 04:20 PM
Thanks for the replies guys.


Thanks dejo, I suppose RTFM applies here :)


Regards Paul