views:

227

answers:

2

hi im trying to create a game in which few objects(UIImageViews) traverse the screen... these objects are generated at an interval of 1 to 0.45 seconds...when they r generating in the range of 1-0.60 seconds they traverse smoothly..but when they generate at a rate less than 0.6 seconds their movement is not smooth they start jerking..also i have a UIImageView which changes the position depending on the the touchesmoved event... please do help

A: 

Obviously your game uses too much cpu-power. Try optimizing it using a profiler (Shark for example) and make your object-creation method less time consuming. (Create a bunch of objects at one time and then just reuse them instead of making new ones?)

What's profiling?

I you don't know profiling at all, read this introduction written by Mike Ash. (Excellent blog btw.)

Here is Apple's Documentation of Shark.

Georg
Actually i have created 10 UIImageView objects at the start of the game itself..and im reusing them..also i would like to add that in my game the user constantly moves another UIImageView by touchesmoved event if it help...and i dont think 10 UIImageView should matter
Snehal
Try to profile it, that should show you all performance bottlenecks. (I suspect it's where you generate them, that it takes too much time.)
Georg
I dont get it? what do mean by profile it?? can u please elobrate on the same?
Snehal
Snehai: Read the answer. It has a section titled “What's profiling?”. Then read the links in that section.
Peter Hosey
I've added that as an answer to his comment. :)
Georg
A: 

hey guys I was able to solve the problem by creating 3 different threads ie one for generating the objects, one for traversing the objects and another for moving the object on the touches move event. I was previously using timers for it...

but using the threads solved the problem

Anyways thanks for all your help :)

Snehal