Pretty simple question, but I just can't get it to work right. I need to be able to access the string header value of a section when a cell within that section is clicked.
My initial attempts haven't been working:
[tableView titleForHeaderInSection:1];
The reason I thought that would work is because I am also using this:
[tableView cellForRowAtIndexPath:indexPath];
Which works fine. I'm implementing the delegate, but I still get the warning that UITableView may not respond to titleForHeaderInSection. And then it crashes because of an unrecognized selector.
All I need to do is pass the string value of the cell title, and the section title into the next view.
What am I doing wrong? Is there a better approach? Thanks
titleForHeaderInSection
is the method of UITableViewDataSource
protocol which is implemented by the client class not UITabelView
.
So you can't call titleForHeaderInSection
on your UITableView
instance.