Reputation: 682
I have a class called SKButton
, subclass of SKSpriteNode
, which implements the touchesBegan()
function to print("hello")
. But when i add an SKButton
object to my view, touchesBegan()
never gets called on the button. Why?
Upvotes: 1
Views: 857
Reputation: 88
Also keep in mind that coming from Swift 2.3 to Swift 3 in your project might trigger the warning for the name of the method, you update it using the default fix and then you end up like me wondering why the methods related to touches are not called despite of the fact that you set userInteractionEnabled. Fix: make sure that method name is written as per your current version of Swift!
Upvotes: 1
Reputation: 2650
You need to make sure that userInteractionEnabled is enabled on all of the superviews of your view.
Upvotes: 4