ChrisP
ChrisP

Reputation: 10116

How do you retrieve the title of a UITableView section header after the table is displayed?

After displaying a UITableView that contains several sections I want to retrieve the title for a specific section. I see how you can retrieve a specific row but not a section title. Is there a way to retrive a section title assuming you no longer have the original list/data used to create those section titles?

Upvotes: 0

Views: 229

Answers (1)

Steven Stefanik
Steven Stefanik

Reputation: 485

How could you not have the original data used to set the section titles? The section title would not display on the UITableView if the data behind the title didn't exist.

Review the UITableViewDataSource protocol:

http://developer.apple.com/library/ios/#documentation/uikit/reference/UITableViewDataSource_Protocol/Reference/Reference.html

- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section

This is presumably how you set the section titles. So whatever data you used here is what you should be looking at.

When you use the word "retrieve", it sounds to me like you may not fully understand what a UITableView is. It is not where data is stored, it is how it is displayed. You don't retrieve anything from a UITableView.

Upvotes: 1

Related Questions