我想获得一个与 UIButton(类型:.system)相同的 buttonNode。如何设置
问问题
273 次
1 回答
2
let buttonNode = ASDisplayNode { () -> UIButton in
let button = UIButton(type: .system)
button.backgroundColor = UIColor.white
button.cornerRadius = 4
button.setTitleColor(UIColor.red, for: .normal)
button.titleLabel?.font = UIFont.systemFont(ofSize: 17)
return button
}
if let button = buttonNode.view as? UIButton {
button.setTitle("qqq", for: .normal)
button.addTarget(self, action: #selector(tapAction), for: .touchUpInside)
}
于 2017-07-18T08:31:51.257 回答