DNewell
DNewell

Reputation: 475

Fixed button at bottom of UITableView

I have a view controller which has a tableview subview. I have made the tableview height smaller, leaving about 46 pixels for a button that needs to stay at the bottom and not scrolled with the table.

I have played around changing the height of the table view (in IB) and it doesn't seem to change anything. Any help would be appreciated.

Upvotes: 0

Views: 3271

Answers (2)

defvol
defvol

Reputation: 15450

This can be done programmatically in the UITableViewDelegate:

- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section
{
    // Build a custom view
    // ...
    // Build a custom button
    // ...
    [customFooterView addSubview:button];

    return [customFooterView autorelease];
}

- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section
{
    return 53.0; // return your button's height
}

Upvotes: 0

user189804
user189804

Reputation:

You need to have the UIButton at the same level as the UITableView - both are subviews of the main view. Do you have the UITableView as the view of the view controller?

Upvotes: 1

Related Questions