iOS UITableView:底部的UIView /自定义单元格,如在Twitter iPad应用程序中 [英] iOS UITableView: UIView/custom cell at the bottom like in twitter iPad app

查看:112
本文介绍了iOS UITableView:底部的UIView /自定义单元格,如在Twitter iPad应用程序中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Xcode 4.3中提供的主 - 详细信息模板创建一个iPad应用程序。我的主tableview充当详细视图的导航菜单,菜单项将被修复。所以我基本上不需要滚动视图,因此我将其关闭。

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;

现在我需要在主菜单底部显示一个像单元格对齐的页脚,就像在Twitter iPad应用程序。单元格应以横向和纵向模式显示在底部。有人可以给我一些关于如何实现这个的提示吗?

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?

我在一些博客上看到有关使用UIView并将其设置为UITableView.tableFooterView的内容,这样的话......

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;


推荐答案

看完应用程序后,我不认为页脚是表格的一部分。它看起来更像是桌子底下的一个小视图。因此,表格设置为垂直拉伸,但高度锁定在底部视图上方。也许最好使用 UIViewController UIView 为你的主视图而不是的UITableViewController 。然后将 UITableView 放在 UIView 中,并将页脚放在它下面。然后配置 UIViewController 以像以前一样使用 UITableView

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.

希望这会有所帮助。

这篇关于iOS UITableView:底部的UIView /自定义单元格,如在Twitter iPad应用程序中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆