views:

618

answers:

4

In my game if I play a particular game for several times, my touches need more time to be detected. It stores all touches and then applies those touches all at the same time.

Can anybody tell me what's the problem?

In touchesBegan I wrote:

if (CGRectContainsPoint([tapView frame], [touch locationInView:self])
    && tapView.alpha == 1) {
    [self callTapCode];
}

This is the code of touchesEnded. If I tapped and release the tapped it shows one tapping event.

- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {
    if (checkTap == TRUE && tapView.alpha == 1 )
        tap_effect_view.alpha = 0;
}

- (void)callTapCode {
    // Move player code by 6 pixels
    // not possible to write all code
}

In tapView I continuously tap. callTapCode moves the player by six pixels. But after some time my touches detected very slowly, so that the player looks like he's jumping around. I played the game continuously 15 to 16 times.

A: 

Try to look for any memory leaks. Maybe the iPhone has to use virtual memory a lot.

Georg
In my game when i am tapping there is one user player. when i tapped on tapView once it moves the player by 6 pixels. How much fast i tapped it moves the player. But after some times means if i play my game 16 to 18 times it detect the tap very slow.
Jyotsna
It applies all the remaining tap at time on player so player looks like jumping. to check whether processors are slow i just call the same tap code in timer and run the game 20 to 25 times but it works fine. Means its not issue of processor slow so can u help me
Jyotsna
Do you release the stored touches? And how do you do it?
Georg
And try to write 'you' instead of 'u'. and instead of 'i': 'I'. It gets easy after a while.
Georg
Oh! Thank you for the suggestion I will always remember it.
Jyotsna
I don't know how to release the stored touches? If you know can u please tell me. :)
Jyotsna
That depends on the code you have in [self callTapCode] I think.
Georg
+1  A: 

You might work through this tutorial to learn how to use the Leaks Instrument. This is part of the Instruments suite that comes with Xcode, which will, among other things, help you track down memory leaks and general performance issues with your application.

Alex Reynolds
Ya i also use this but it does not make lot of difference
Jyotsna
What does Leaks report when you create touch events (when you touch the screen)? I would recommend that you go through the tutorial so that you can learn this tool. It really is quite useful.
Alex Reynolds
A: 

I'm afraid I have no answer but I may have a similar problem. This afternoon I noticed my app slowing down as I ran it and generated events.

It seemed to happen only for debug builds on the phone under the debugger (i.e. I can't reproduce it away from my Mac). Do you see this bahaviour on the simlator or running without attachment to the debugger?

Roger Nolan
+1  A: 

Hi to all

I found the solution to my problem. In my game I had enabled the tapView.multipleTouchEnabled = TRUE

tapView is the view where I was continuously tapping.

When I make it FALSE it works.

i.e.

tapView.multipleTouchEnabled = FALSE;

I exactly dont know how. But it works.

Thanks for the replies.

Jyotsna