2018-08-22 Swift set UIButton
作者:
自流虎 | 来源:发表于
2018-08-22 11:42 被阅读0次
Swift4.0一些改变
func bt () {
let bt = UIButton()
let rect = CGRect(x: 100, y: 100, width: 100, height: 40)
bt.frame = rect bt.setTitle("按钮", for: UIControlState.normal)
bt.setTitleColor(UIColor.red, for: UIControlState.normal)
let sel = #selector(btClick(_:))
bt.addTarget(self, action:sel, for: UIControlEvents.touchUpInside)
view.addSubview(bt)
}
@objc func btClick(_ bt:UIButton) {
print("btClick()")
}
本文标题:2018-08-22 Swift set UIButton
本文链接:https://www.haomeiwen.com/subject/wubeiftx.html
网友评论