Reputation: 817
I am looking at making a table view section that extends another section like the image. Although this is purely aesthetic if you know of an easy way of doing this I would like to know.
Upvotes: 1
Views: 182
Reputation: 52227
You different section can have different background image and different frames for the subviews.
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"myCell"];
if(cell == nil) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"LOC_ID"];
[cell autorelease];
}
if(indexPath.section == 0){
if(indexPath.section == 0 && [self tableView:numberOfRowsInSection:0]-1 == indexPath.section){
//put background image for last row in section 0
} else {
//backgroundimaes for all other cells in section0
} else if(indexPath.section == 1) {
//configure section 1 ibackgroundimages
}
}
return cell;
}
setting background of an cell
cell.backgroundView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"cell_bg.png" ]autorelease];
cell.selectedBackgroundView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"cell_selected_bg.png"];
Upvotes: 1
Reputation: 5173
Nice diagram. If you are trying to create a UITableView with sections that have different widths, that is not possible. You will have to use two separate UITableViews with different widths, and put one below the other. Or just set up some UITableViewCells manually and don't use a UITableView at all.
Upvotes: 1