tableview 背景空白点击

UIGestureRecognizerDelegate


        let tag = UITapGestureRecognizer.init(target: self, action: #selector(ChangeGoodsNormsVC.test))
        tag.delegate = self
        self.tableView.addGestureRecognizer(tag)



    func gestureRecognizer(_ gestureRecognizer: UIGestureRecognizer, shouldReceive touch: UITouch) -> Bool {
        
        if (touch.view?.isKind(of: UITableView.self))!  {
            return true
        }
        else
        {
            return false
        }
        
        
    }

处理透明读度

        self.View?.backgroundColor = UIColor.black.withAlphaComponent(0.3)
//tableview必须双清
        self.tableView.backgroundColor = UIColor.clear
        self.tableView.backgroundView?.backgroundColor = UIColor.clear

你可能感兴趣的:(tableview 背景空白点击)