1.设置section的数目,即是你有多少个cell
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView 
{
    return 3; // in your case, there are 3 cells
}2.对于每个section返回一个cell
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return 1;
}3.设置cell之间headerview的高度
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
    return 10.; // you can have your own choice, of course
}4.设置headerview的颜色
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
{
    UIView *headerView = [[UIView alloc] init];
    headerView.backgroundColor = [UIColor clearColor];
    return headerView;
}注意:需要使用 indexpath.section 来获得index,而不是用 indexpath.row
cell.textLabel.text=[NSString stringWithFormat:@"%@",[array objectAtIndex:indexPath.section]];http://stackoverflow.com/questions/7189523/how-to-give-space-between-two-cells-in-tableview
iOS 在TableView的Cell之间设置空白间隔空间,布布扣,bubuko.com
原文:http://blog.csdn.net/willyang519/article/details/38521057