Developer
Developer

Reputation: 1435

How to add button to the last section of the UItableviewcontroller?

i would like to add last section of UiTableviewcontroller with image button.

In my app i have taken TableViewController.

In that i set table view style as grouped data. I have created section in table view.

Now i want to put Custom button in the last section of table view which scroll with the table view . How to set last section with custom button image?

Upvotes: 0

Views: 395

Answers (3)

EmptyStack
EmptyStack

Reputation: 51374

You can have a button on the bottom of a table view by several ways. You can add the button as the footer view of the table (or as the footer view of the last section of the table view).

tableView.tableFooterView = theImageButton;

If you really want to have it in a section, you can add the last section with just 1 row and add the button as the subview of the cell's contentView.

[cell.contentView addSubview:theImageButton];

Upvotes: 2

PawanShakya
PawanShakya

Reputation: 97

Adding into footer is really easy to implement. You can add anything as a view there button/image [cell.contentView addSubview:view];

Upvotes: 1

d.lebedev
d.lebedev

Reputation: 2303

Add the button to tableview.tablefooterView.

I use that way in the case you described.

Upvotes: 1

Related Questions