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

久未见 提交于 2019-12-23 05:22:18

问题


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;

回答1:


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.



来源:https://stackoverflow.com/questions/10241192/ios-uitableview-uiview-custom-cell-at-the-bottom-like-in-twitter-ipad-app

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!