2

So I have been trying to make a program that tracks each finger as it moves across the screen. The first thing I have started to do is keeping track of how many fingers are down at a given time. I have simply been doing this by adding in the "TouchesBegan" method and subtracting in the "TouchesEnded" function. However as soon as the user does more the 5 touches (im on ipod 5) everything goes wacky and the count gets thrown up. Here are some questions.

  • Is there a way to detect when the user puts too many touches?
  • How can I figure out the maximum amount of touches allowed on a given device?

Thanks much!

Note: I didn't feel sample code was necessary for this one. I just described the simple addition and subtraction things I was doing.

Edit: Inside of the touches began function I now check if touchCount is >= 5 and then set it to 0 if so. Now the counting is all right, however it stays at 5 even when no fingers are down.

J.Doe
  • 1,502
  • 13
  • 47
  • Note that the maximum number of touches is a hardware limit, and the OS can't know more than the hardware does. So, if the device can only handle five touches, and you cram six fingers onto the screen, which five get reported and how they track over time is undefined behavior. – rickster Dec 18 '15 at 21:38

0 Answers0