/**
创建button
*/
func createButton(){
btnTest = UIButton()
btnTest.frame = CGRect(x: 50, y: 150, width:screenWidth-100, height: 50)
btnTest.backgroundColor=#colorLiteral(red: 0.4666666687, green: 0.7647058964, blue: 0.2666666806, alpha: 1)
btnTest.titleLabel?.font = UIFont.systemFont(ofSize: 30)
btnTest.layer.shadowColor = #colorLiteral(red: 0, green: 0, blue: 0, alpha: 1)
btnTest.layer.shadowOffset = CGSize(width: 2, height: 2)
btnTest.layer.masksToBounds = true
btnTest.layer.borderColor = #colorLiteral(red: 0.9764705896, green: 0.850980401, blue: 0.5490196347, alpha: 1)
btnTest.layer.cornerRadius = 23
btnTest.layer.borderWidth = 2
btnTest.setTitle("暂停", for: .normal)
btnTest.setTitleColor(UIColor.black, for: .normal)
btnTest.setTitleShadowColor(UIColor.red, for: .normal)
btnTest.setTitle("触摸状态", for: .highlighted)
btnTest.setTitleColor(UIColor.red, for: .highlighted)
btnTest.setTitleShadowColor(UIColor.green, for: .highlighted)
btnTest.setTitle("禁用状态", for: .disabled)
btnTest.setTitleColor(UIColor.gray, for: .disabled)
btnTest.setTitleShadowColor(UIColor.black, for: .disabled)
self.view.addSubview(btnTest)
btnTest.addTarget(self, action: #selector(myClick(sender:)), for: .touchUpInside)
}
@objc func myClick(sender:UIButton){
print("触发了点击事件")
}