美文网首页
swift 懒加载按钮

swift 懒加载按钮

作者: HitlerCoding | 来源:发表于2019-01-24 11:19 被阅读5次
     // 懒加载按钮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
        }()

相关文章

网友评论

      本文标题:swift 懒加载按钮

      本文链接:https://www.haomeiwen.com/subject/bfdyjqtx.html