iOS Swift给uiview添加tap点击事件

本人亲测有效!绝对可靠!更多交流可以家魏鑫:lixiaowu1129,一起探讨iOS相关技术!

let tap = UITapGestureRecognizer(target: self, action: #selector(tap(r:)))
       clickView.addGestureRecognizer(tap)

 @objc func tap(r: UITapGestureRecognizer) {
            stickers.forEach { s in
               //点击事件
            }
        }

你可能感兴趣的:(iOS Swift给uiview添加tap点击事件)