views:

1216

answers:

2

Hello, i am trying to create a simple puzzle game.. and i have an int[8][8] array that reprents the map.. each cell has a value which represents some item.

now i want to draw this map on the screen, i have an image file for each item. (each item has the same width and height)

i tried to do this with creating a UIImageView for each cell and add it to the View.

But what shall i do if the puzzle changes (it changes after each move.. so very often)? Remove all UIImageViews and create new..?

I do all the logic with the int[][] map..

What would you reccommend me to draw the map ?

Thank you, chris

+1  A: 

Just change the "image" property on the existing UIImageView with a new image and you should be all set.

Eric Petroelje
A: 

In general, all of the UIView properties can be changed and the view heirarchy will redraw to reflect the changes. As Eric says, you can simply change the image property of you UIViews and the images drawn will change.

The same applies to the frame (or center and bounds) and all the other properties.

I suggest that after you have got your code working like this, you look at CoreAnimation which can help smooth the transitions you will be generatring.

Roger Nolan