swift——图片添加点击事件

来源:互联网 发布:js去除disabled属性 编辑:程序博客网 时间:2024/06/05 07:55

let taget = UITapGestureRecognizer(target:self, action: "imgAction")

                taget.numberOfTapsRequired = 1

                img.userInteractionEnabled = true

                img.addGestureRecognizer(taget)


//如果带有参数,写一个类

import Foundation

import UIKit

//带有参数得手势识别

class UserInfoTapRecognizer: UITapGestureRecognizer {

    var userInfo: [StringString] = [:]

}


0 0