问题
I've noticed that touchesEnded don't always get delivered to an SKScene on multi touch. Depending on speed of removing fingers etc, I would permanently miss some of the touchesEnded. touchesCancelled is implemented and I added a custom UIView and put over the left side of the screen - no problems. I made a custom SKView and captured events - again no problem.
It's obvious that SKScene doesn't get all the touchesEnded the SKView it's embedded in, but why?
(BTW, I'm running the SKScene completely without any nodes)
EDIT:
Some further investigation reveals I can get SKScene to lose a touch entirely:
I put 3 fingers on the display then remove them one at a time until only one finger touches. I move the finger -> only the SKView receives the move events, the SKScene doesn't. Nor does it receive the touchesEnded.
After some experimentation I can say that it happens when a touchesBegan receives more then 1 touch in a call (e.g. you press two fingers "simultaneously"). These two touches then get entangled so only one of them sends events.
This appears to be a bug in SKScene. I'm testing on an iPhone 5. It would
回答1:
May be you are using some gestureRecognisers? They have property cancelsTouchesInView and it's default value is YES. Changing it to NO solved my problem.
来源:https://stackoverflow.com/questions/19689885/spritekit-skscene-missing-touchesended