Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Setting a basic footer to a UITableView

How is a basic footer set to a UITableView programmatically?

Just a centered text?

EDIT:

How can the bar color be set and the footer bar position fixed to the bottom of the screen or if the thumbs dont fill a screen, the footer isnt above the bottom of the screen.

enter image description here

like image 652
some_id Avatar asked Feb 24 '11 23:02

some_id


People also ask

What is header and footer in Swift?

Customize the header and footer views With custom headers and footers, you specify the views you want and position them anywhere within the allotted space. You can also provide different header or footer views for different sections of your table.

What is Section in UITableView?

UITableView with sections allows us to separate the list into different categories, so the list looks more organized and readable. We can customize sections as per our need, but in this tutorial, we are covering the basic UITableview with sections. Here's is the video if you prefer video over text. Let Create An App.


2 Answers

viewForFooterInSection sets the section's footer. To set the table's footer, you want to set

self.tableView.tableFooterView = myCustomFooterView

where myCustomFooterView is something you setup elsewhere. You'd probably set that in viewDidLoad.

like image 192
Nick Curran Avatar answered Oct 16 '22 03:10

Nick Curran


You can use UITableViewDataSource callback (just text):

- (NSString *)tableView:(UITableView *)tableView titleForFooterInSection:(NSInteger)section

Or UITableViewDelegate (any custom view you like):

- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section
like image 24
Max Avatar answered Oct 16 '22 05:10

Max