Reputation: 1145
I have over 150 UIImageViews. I need them to behave like a large ballet. I also need to be able to dynamically choreograph them. Some spin, some duck, some jump (each currently a different UIImageView subclass).
I'm assuming I need to put them all into an NSDictionary, then grab the object based on a key and say "you spin", "you jump", "you duck". And do those moves in sync while the music is playing (no real music, but instead data coming in from an external source). And I have no idea what that music(data) will be until it arrives, and no one's heard the song before. I've setup a while (music){}
loop with a large switch statement inside.
I'd like to place all the ballerina's on the view in the nib by hand so that they line up correctly with the subview. None of them change x,y. They might only change z, and maybe swap an image, fade opacity, etc (which I was calling spin, duck and jump). And there is no user interaction here, you're just in the audience.
I'm also assuming I'll need to use the UIView's beginAnimation, setAnimation, commitAnimation methods.
Am I on the right track? What's the best way to achieve this? Any optimizations I should consider?
Apologies for all the analogies, it's the easiest way to explain what I'm trying to achieve.
Upvotes: 2
Views: 160
Reputation: 40211
I recommend you look at UICollectionView
. There was a great WWDC session about it. I'm not exactly sure what you're trying to achieve, but with UICollectionView
you can set up custom layouts and animate between different layouts automatically. So if your images have to move in sync, this might be a good option.
Upvotes: 1