user interface - SKButton not working -
so made button programmatically spritekit thinks button node larger button.
here have.
override func didmovetoview(view: skview) { let button = skspritenode(color: skcolor.greencolor(), size: cgsizemake(100, 44)) button.position = cgpoint(x: cgrectgetmidx(self.frame), y: cgrectgetmidy(self.frame)) self.addchild(button) } override func touchesbegan(touches: nsset, withevent event: uievent) { touch: anyobject in touches { let location = touch.locationinnode(self) if button.containspoint(location) { println("tapped") } } }
when run game allows me click button detects touch anywhere below button.
Comments
Post a Comment