Jean
Jean

Reputation: 2625

Custom layout in UITableView

I am coding an iPhone App in which am using a UITableView which has several sections ; each section has a header & then its rows like this:

enter image description here

I can do the row styles correctly, by using custom UITableViewCell objects, but how do I do the header? As you can see:

  1. the header has the text centered with two lines drawn from it, one on each side
  2. The header color is different
  3. also the corners of each section are rounded

how do I achieve this, either programmatically or using Storyboard?

Upvotes: 0

Views: 446

Answers (1)

Andy Obusek
Andy Obusek

Reputation: 12842

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

This method, implemented as part of your UITableViewDelegate, is intended to allow you to to create custom views for headers in UITableViews. You can return any UIView from that method, whether it's one that you want to create in Interface Builder, or in code.

Upvotes: 4

Related Questions