How can I disable the touch detection?
Solution 1
This is the best answer to your question:
[[UIApplication sharedApplication] beginIgnoringInteractionEvents];
[[UIApplication sharedApplication] endIgnoringInteractionEvents];
Solution 2
Disable user interactions in your view till the action completes and then enable it again.
To disable touch
[self.view setUserInteractionEnabled:NO];
To enable touch
[self.view setUserInteractionEnabled:YES];
Please try and be a bit more concise of what you want the next time.
Solution 3
In Swift 2.2
self.view.userInteractionEnabled = false
Solution 4
Swift 3.0
self.view.isUserInteractionEnabled = false
Solution 5
Just gonna make a wild assumption that you're talking about the specific Action class in Cocos2D. If that's true, then you should know that every Action has an "isDone" Bool you can check to see if it's done. Let me know if that's what you're asking and I'll post an example, but there's a huge chance you could be talking about something else because your wording is so confusing ;)
Admin
Updated on July 09, 2022Comments
-
Admin almost 2 years
How can I disable the touch detection within the action that running, because I don't want the character flying in the sky like a superman if the player clicking and clicking within the action, the character will never land if they keep clicking. I found the method "isDone", is that relate to this method?? player click -> action(cannot click within the action) -> action finish -> click again..... that's what i want~
-
Mazyod almost 13 years+1 For the counter-intuitive, but awesomely working solution.
-
eugene over 12 yearsDave, how do you "disable" tap? have it listen for taps, and have it ignore them?
-
Stephen J almost 12 yearsA button is a bit more efficient at this. To make it "invisible", just make it not highlight, the XIB option is adjustsWhenHighlighted, but the option name is different. +1 for Apple's lack of a standard name scheme! This method is handy for disabling custom UI (games usually)