Drag an image on a shape and populate it

Discussion in 'iOS Programming' started by aztec31, Sep 18, 2008.

  1. aztec31 macrumors newbie

    Sep 15, 2008
    How would I go about dragging an image then populating that image in the area it was dragged too.


    Say I have a shape (square) on the screen, down below I have a list of small icons (like an emoticon), if I drag an icon to the area where the shape is, when I release it I want to populate that icon (or different icon) inside the shape area at random.

    Can someone provide info on how to do the following:

    1) How would I approach the example above(high level, point me to the ares I need to start reading on)? Do i need to use Quartz? Can it be done using just the UIKit?

    2) If I wanted to split the screen in a way that the bottom 1/3 can have the icons and the remaing 2/3 has the shape, and upon the user swipping his finger from the right to the left you see a second list of icons
    Llike on the iphone home where all the applications are listed if you have too many you get a second page and you can see it by touching the screen and moving to the left and you see the other page of apps you have installed
    Can this be possbile? Upon moving from page to page you would see different icons but it would not affect the view of the top 2/3 of the screen. The 2/3 top part of the screen would remain unchanged. If so what is the approach?
  2. aztec31 thread starter macrumors newbie

    Sep 15, 2008
  3. PhoneyDeveloper macrumors 68040


    Sep 2, 2008
    Your description of what you want is a bit vague. I'll give a try to your number 1.

    If you have a handful of images, say up to 20, then you probably want each one to be a UIView subclass. Most likely UIImageView, or a UIImageView subclass, or your own UIView subclass that draws images. Your images can come from png files or from images that you construct with Quartz.

    If you want to modify existing images by badging or drawing a smaller image onto a larger image to make a combined image, you do this with Quartz.

    Read the Quartz 2D programming guide. There is plenty of example code on the web.

Share This Page