I add a button as spriteNode to a scene, and i want to run an action when the touch cancelled.
I add a "touches-cancelled" method and write an "NSLog" to test if this method is called. After I run my project, there is no output showing this method is called.
how can i run the "touches cancelled" method to my button?
To be able to effectively implement something like touchesCancelled on a button node based on the touchPosition, you will need to subclass SKSpriteNode to act as a button. It will have to implement the touch delegates on it's own.
A sample of how to do this can be found in this answer:
https://stackoverflow.com/a/19199748/2043580
It includes code which sets the texture back to the unselected state when the touchPoint goes out of the node's bounds in the -touchesMoved
method.