Reputation: 845
I want to create a button (not dynamically) bellow the last row in the table. All the rows and sections are fixed. Do I have to create another section and row just to add a button? and if yes how can I ajust the button to the same width and curvature of the cell?
Here is what I did. I create a specific section for the button and one row for it.
}else if(indexPath.section ==2)
{
UIButton *cellButton = [UIButton buttonWithType:UIButtonTypeCustom];
[cellButton setFrame:CGRectMake(0.0f, 5.0f, cell.frame.size.width, 44.0f)]; // not filling the round parts of the cell
[cellButton setBackgroundColor: [UIColor yellowColor]];
[cellButton setTitle:@"test" forState:UIControlStateNormal];
[cell.contentView addSubview:cellButton];
}
return cell;
Upvotes: 0
Views: 84
Reputation:
You don't. Set your button as the table footer view of your table view.
tableView.tableFooterView = myButton;
Upvotes: 2