Container View里面的CollectionView没有执行tapGesture

时间:2017-02-11 06:53:48

标签: ios swift uicollectionview uitapgesturerecognizer uicontainerview

所以我的设置是一个带有集合视图的容器视图。在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")
}

0 个答案:

没有答案