开发者

Create UIImageViews at set intervals?

So I'm making a simple UIKit based iphone game for a class. It's similar to Sky Burger if anyone is familiar. If not, the game will be objects falling from the top of the screen and there will be a character that is controlled by the accelerometer at the bottom of the screen that will catch them.

I have the game loop and cha开发者_运维百科racter movement all done. I know how to animate the ImageViews falling (if i could create them that is). I just cant figure out how to create multiple UIImage views that are created every 1-3 seconds or so.

If anyone could point me in the right direction or has any suggestions of places where I should start looking it would be greatly appreciated.

Also if I'm being unclear just let me know and I'll try to elaborate.


Create an NSTimer, schedule it every 1-3 seconds or so, and in the timer's action method, create the image views ([[UIImageView alloc] initWithImage:]), position them and add them to your main view (-addSubview:).

Don't forget to remove those image views you no longer need or you'll quickly build up so many views that your app will crash.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜