UITableViewController select header for section

后端 未结 4 962
盖世英雄少女心
盖世英雄少女心 2020-12-24 11:47

I have a UITableView with multiple sections. Each section has a section header (a custom view) is there an easy way to detect when someone selects the section h

4条回答
  •  Happy的楠姐
    2020-12-24 12:12

    No there is no way to do it with the UITableViewDelegate.

    What you can do is to add a button the size of the section header view and add it to the view. Set the tag of the button to the section index. Then just add the UIViewController as a target for the UIControlEventTouchUpInside.

    Then by looking at the tag of the button you can see which section is clicked.

提交回复
热议问题