// 懒加载按钮w
lazy var btn:UIButton = {
let btn = UIButton(frame: CGRect(x:150,y: 200, width: 50, height:50))
btn.backgroundColor = UIColor.red
btn.setTitle("跳转",for: UIControlState.normal)
//btn.addTarget(self, action:#selector(tapped(:)), for:.touchUpInside)
btn.addTarget(self, action: #selector(tapped), for: UIControlEvents.touchUpInside)
// btn.addTarget(self, action: #selector(tapped(:)), for: .touchUpInside)
return btn
}()
网友评论