I'm creating a simple slot machine game as an exercise to learn how to program different elements of the iPhone UI.
I have already succeeded in using the UIPickerView control divided into 3 columns, and applying icon images for the slot machine symbols onto each column reel. I can animate the columns, but since they all belong to a single pickerview they can only animate for the same duration.
So if they all start at the same time, they must stop at the same time, unlike a real slot machine in which the reels stop one at a time in sequence. The pickerview is somewhat restrictive.
In order to create a more realistic animation I will need to dispense with the UIPickerView and create my own UI out of individual UIView strips side by side.
I have at least 10 symbols per reel, and the reels need to spin for 3, 4, and 5 seconds. So that means drawing a multitude of repeated UIImageViews on each reel - as much as 80 UIImageViews on a reel.
My question is:
Is it more efficient and better for performance to recycle the same 10 imageViews as the strip moves through the viewport ,
or
simply create all 80 UIImageViews and not have to code the recycling of the views. It seems like creating so many repetitions of the same image is a waste of memory - even though the images are only around 9 -16 kb each.
I've tried to recycle the images as the strip moves but I can't get the code to work, so I'm thinking the simplest method is to just draw all the images and forget about it.
My main concern is for performance and efficiency.
I have already succeeded in using the UIPickerView control divided into 3 columns, and applying icon images for the slot machine symbols onto each column reel. I can animate the columns, but since they all belong to a single pickerview they can only animate for the same duration.
So if they all start at the same time, they must stop at the same time, unlike a real slot machine in which the reels stop one at a time in sequence. The pickerview is somewhat restrictive.
In order to create a more realistic animation I will need to dispense with the UIPickerView and create my own UI out of individual UIView strips side by side.
I have at least 10 symbols per reel, and the reels need to spin for 3, 4, and 5 seconds. So that means drawing a multitude of repeated UIImageViews on each reel - as much as 80 UIImageViews on a reel.
My question is:
Is it more efficient and better for performance to recycle the same 10 imageViews as the strip moves through the viewport ,
or
simply create all 80 UIImageViews and not have to code the recycling of the views. It seems like creating so many repetitions of the same image is a waste of memory - even though the images are only around 9 -16 kb each.
I've tried to recycle the images as the strip moves but I can't get the code to work, so I'm thinking the simplest method is to just draw all the images and forget about it.
My main concern is for performance and efficiency.