-1

I have a touchesmoved method that moves a ball depending on the position of the user's touch. How can I stop the ball from being dragged after the user gets a "Game Over".

Example - An NSTimer will be cancelled by calling [NSTimer invalidate]. How can I do that but with a touchesmoved method?

MrBear36
  • 1
  • 1

1 Answers1

3

You could disable user interaction in the view: view.userInteractionEnabled = NO;

That way the touchesMoved function would not be called, but would also disable any UI elements in that view.

Another option is to have a BOOL gameOver variable, and in your touchesMoved function check the value, if it's true, return immediately and do nothing.

EmilioPelaez
  • 18,758
  • 6
  • 46
  • 50