uitableviewios5table-footer

iOS UITableView: UIView/custom cell at the bottom like in twitter iPad app


I am creating an iPad app using the master-detail template available in Xcode 4.3. My master tableview is acting as a navigation menu for the detail view and the menu items will be fixed. So I basically don't exactly need the scrolling view, thus I have turned it off.

self.tableView.scrollEnabled = NO;

Now I have a requirement to display a footer like cell aligned at the bottom of master menu just like in Twitter iPad app. The cell should appear at the bottom in landscape as well as portrait modes. Can somebody give me some hints regarding how to implement this?

I read on some blogs about using a UIView and setting it to UITableView.tableFooterView, something like this...

// I'll have to do calculations of frame height/x/y for both orientations 
// to make the view appear at bottom - IS THERE A SIMPLER WAY???
UIView *footerView =  [[UIView alloc] initWithFrame:CGRectMake(0, 944, self.tableView.frame.size.width, 60)];

UILabel *logo = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 200, 60)];
logo.text = @"This is the Footer.";
[footerView addSubview:logo];
self.tableView.tableFooterView = footerView;

Solution

  • After looking at the app, I don't think the "footer" is part of the table. It looks more like a small view under the table. So the table is set up so it will stretch vertically but it's height is locked above the bottom view. Maybe it would be better to use a UIViewController and a UIView for you Master View instead of a UITableViewController. Then put your UITableView in the UIView and put your footer below it. Then configure the UIViewController to work with the UITableView as it did before.

    Hope this helps.