sgbutton
把SgButton.swift加入项目工程就可以了。
使用方法:
func initUI() {
let btnPlay = SgButton(normalImageNamed: "bkbtn.png", highlightedImageNamed: "bkbtn_d.png", buttonFunc: callbackPlay )
btnPlay.setString(.normal, string: "Play")
btnPlay.setString(.highlighted, string: "Play")
self.addChild(btnPlay)
btnPlay.position = CGPoint(x: frame.width*0.5, y: frame.height*0.5)
}
func callbackPlay(_ button: SgButton) {
print("play go")
}