Swift + SpriteKit – Button is clickable even when not visible
This question already has an answer here:
SKLabelNode will disappear but is still clickable
Solutions Collect From Internet About “Swift + SpriteKit – Button is clickable even when not visible”
It seems that whether or not the node is added to the parent,
containsPoint method will behave the same. Means, it will always return
true if the given point lies inside of parent’s (in your case, button’s) coordinate system.
You can check this by initializing the
attackButton without adding it to the scene. If you tap in the lower left corner of the scene, the message from the
touchesBegan will be still printed.
I guess, this is happening because of the fact that each node has its
position property set to
CGPoint(0,0) by default. Also, in your case, the button has its size. And it will have its size and position set even if it’s not added to its parent (or if removed from its parent) because it is obviously defined as a property and there is a strong reference to it.
- how to display test IAd banner in the simulator
- iOS 5 Storyboards: Classes For Each Scene
- Calculating IOS signal strength using CTGetSignalStrength()
- Multiple file upload with array of parameters using Alamofire
- Parser XML with NSXMLParser
- Drag Rotate a Node around a fixed point
- Firebase – iOS Swift: FIRAuth.auth().signOut() not signing out current user
- Amazon AWS IOS SDK: How to list ALL file names in a FOLDER
- Creating a time range for AVAssetExportSession
- Xcode 9 is taking too much time to load the Application
- How to increase badge number when application is in background
- How to get error statusCode from `MoyaError`?
- Submitting iOS app using beta version of xcode?
- Resizing cells to fit labels, has set image size and label has some rounded corners
- NSURL fail able initialiser initWithString: does not return nil on empty String in Swift