hungbm06
hungbm06

Reputation: 1549

[iPhone]How to customize header of Section in grouped TableView?

To customize cell, we implement class inherit UITableViewCell. Now, to customize header of Section in grouped UITableView (same to below picture), how to do? Please guide to me!
alt text

Upvotes: 4

Views: 5909

Answers (2)

agarcian
agarcian

Reputation: 3965

Starting with iOS 5 you also need to implement

- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section

In addition to

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

Otherwise it won't work.

From Apple's reference

The returned object can be a UILabel or UIImageView object, as well as a custom view. This method only works correctly when tableView:heightForHeaderInSection: is also implemented.

Upvotes: 6

Ole Begemann
Ole Begemann

Reputation: 135548

Implement tableView:viewForHeaderInSection: in your table view delegate.

Upvotes: 12

Related Questions