views:

68

answers:

1

Hi

I have to do some different views containing 72 LED lights. I built an LED Class so I can loop through the LED's and set them to different colors (Green, Red, Orange, Blue None etc.). The LED then loads the appropriate .png.

This works fine, I loop over the LED's and set them. Now I know that at some time they will need to not just turn on/off change color, but will have to turn on with a small delay. Like an equalizer.

I have a 5-10 views containing the 72 LED's and I would like to achieve the above with the minimum amount of memory/CPU strain.

for(LED *l in self.ledArray) {

    [l display:Green];
}

I simply loop as shown above and inside the LED is a switch case that does the correct logic. If this were actual LED's and a microController I would use sleep(100) or similar in the loop, but I would really like to avoid stuff like that for obvious reasons.

I was thinking that doing a performOnThread withDelay would really be consuming, so would UIView animation changing the alpha and NSOperation would also be a lot of lifting for a small feature.

Is there a both efficient and clever way to go around this?

Thanks for any inspiration given:)

+1  A: 

I would definitely use OpenGL!

rjobidon
Hi rjobidonIs the overhead of using .png's so large that it is justifiable?I have been experiencing a bit of lag since implementing the above with png's, I just haven't gotten around to proving that the png's are the culprits.Thank for the input:)
RickiG
OpenGL will be a charm to handle the large amount of image manipulation, with a high frame rate. If you don't want OpenGL, you can also implement an off-screen buffer to do sprite manipulation then update one single image view. It could be simplier than OpenGL and more efficient than 72 independent images to handle. Your first solution is straight forward but forces the OS to handle 72 graphical objects... Good luck!
rjobidon