所以我的设置是一个带有集合视图的容器视图。在Collection视图中,我有" messageImageView"。但是,当我尝试点击messageImageView时,它不会执行该功能。以下是我使用
的代码let messageImageView: UIImageView = {
let imageView = UIImageView()
imageView.translatesAutoresizingMaskIntoConstraints = false
imageView.layer.cornerRadius = 24
imageView.layer.masksToBounds = true
imageView.contentMode = .scaleAspectFill
imageView.isUserInteractionEnabled = true
imageView.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(handleZoomTap)))
return imageView
}()
func handleZoomTap(tapGesture: UITapGestureRecognizer) {
print("thisisatest")
}