shouldReceiveTouch on UITableViewCellContentView

后端 未结 5 493
清歌不尽
清歌不尽 2020-12-31 07:27

I\'m trying to ignore UITapGestureRecognizer taps on a UITableView with the following:

- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer sho         


        
5条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-31 07:48

    I think its clear and simpler to check touch region.

    func gestureRecognizer(_ gestureRecognizer: UIGestureRecognizer,
                           shouldReceive touch: UITouch) -> Bool {
    
        let point = touch.location(in: viewContentContainer)
        return !tableRules.frame.contains(point)
    }
    

提交回复
热议问题