How to make UITableView Header selectable?

后端 未结 12 1289
执笔经年
执笔经年 2020-12-16 11:49

I have made a custom section-header for UITableView, that includes some controls like segmented control, UIImageView ,etc. It successfully appears, but it\'s not tappable so

12条回答
  •  遥遥无期
    2020-12-16 12:29

    swift solution for this:

    let tapR : UITapGestureRecognizer = UITapGestureRecognizer(target: self, action: "gotoHeaderArticle")
    tapR.delegate = self
    tapR.numberOfTapsRequired = 1
    tapR.numberOfTouchesRequired = 1
    yourView.addGestureRecognizer(tapR)
    

    Then implement

    func gotoHeaderArticle() {
    
    }
    

    Make sure to make your calling viewcontroller adhere to UIGestureRecognizerDelegate

提交回复
热议问题