GenieWanted
GenieWanted

Reputation: 4513

Loading Section Title From an Array

I am a newbie here. I have a UITableView in which I load data dynamically. I know how to pass values from an array to a cell. But, I would like to have multiple sections in my table and want to pass different section titles for the sections I have. Is there anyway I can pass String values from an array to the "titleForHeaderInSection" method?? Thank you in advance.

Upvotes: 1

Views: 156

Answers (2)

John
John

Reputation: 505

In your TableViewDelegateProtocol handler implement

- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section

Create a UIView with a UILabel subView holding the text you want to display and return it. The easiest way to create the HeaderView would be via an xib file.

Upvotes: 0

ross_t
ross_t

Reputation: 511

This prior SO question/answer should give you what you want?

iPhone: Setting section titles from an Array

Upvotes: 1

Related Questions