views:

24

answers:

1

I would like to present a UITableView with a basic layout like this:

    header view
    table row
    table row
    table row
    header view
    table row 
    table row

Grouped style with section header views is the natural way to do this, but I don't want the "shunken (padding on the left and the right), rounded corner" look that grouped sections have. I'd like the look to be like an indexed plain table: table rows are all rectangular and full-width, with periodic header sections to separate the table rows into groups.

Is this possible with a grouped style table? Or can I simulate this with a plain table and custom content views for the section headers? Or is there another way to do this? I'd like to reuse as much of UITableView as possible, without having to write a full custom control.

A: 

Hi,

I'dd go for the second option you presented. What you can do is use the delegate methods viewForHeaderInSection and viewForFooterInSection. http://developer.apple.com/iphone/library/documentation/UIKit/Reference/UITableViewDelegate_Protocol/Reference/Reference.html#//apple_ref/occ/intfm/UITableViewDelegate/tableView:viewForHeaderInSection:

Regards,
Paul Peelen

Paul Peelen
I somehow assumed plain style tables couldn't have more than one section, and thus couldn't have section header views. Setting the table style to plain with multiple sections (and using viewForHeaderInSection as you note) gives me just what I wanted.
Bogatyr
Great, glad I could help :) Good luck! /Paul
Paul Peelen