[英]Where should I add my subview to have it UNDER my table view in a UITableViewController?
I'm using parse's PFQueryTableViewController
, which is almost exactly the same as a UITableViewController
except it handles some querying in the background. 我正在使用parse的
PFQueryTableViewController
,它与UITableViewController
PFQueryTableViewController
,只不过它在后台处理一些查询。
My goal is to place a static toolbar at the bottom of the screen. 我的目标是在屏幕底部放置一个静态工具栏。 I decided to do this by giving
tableView
a smaller frame, and creating and adding my toolbar subview below the tableView
, as a subview to the same view that the tableView
is a subview of. 我决定通过给
tableView
一个较小的框架,并在tableView
下面创建和添加我的工具栏子视图来实现此目的,以作为tableView
所在子视图的同一视图的子视图。
Here's a photo. 这是一张照片。 I am trying to add my toolbar to the little white space at the bottom of the screen.
我试图将工具栏添加到屏幕底部的空白处。 That whitespace does NOT scroll with the table view:
该空格不随表格视图滚动:
I have tried [self.view addSubview: toolbar]
, however, this just adds it to the tableView, and as a result, my toolbar scrolls with it. 我尝试过
[self.view addSubview: toolbar]
,但是,这只是将其添加到tableView中,结果,我的工具栏随之滚动。 I can't seem to find any documentation on the view hierarchy for a UITableViewController. 我似乎找不到关于UITableViewController的视图层次结构的任何文档。 Anyone know where I should add my toolbar subview?
有人知道我应该在哪里添加工具栏子视图吗? I should also mention that all of this is sitting inside of a
UINavigationController
. 我还应该提到,所有这些都位于
UINavigationController
内部。
A PFQueryTableViewController
(like all UITableViewController
s) has a table view as its view
. PFQueryTableViewController
(像所有UITableViewController
一样)具有一个表视图作为其view
。
If you want to have other views within the view controller, either don't use a table view controller, or subclass UINavigationController
. 如果要在视图控制器中包含其他视图,请不要使用表视图控制器或
UINavigationController
子类。
Alternatively, you can set the view controller's toolbarItems
property, and the navigation controller will take care of making and configuring a standard toolbar. 另外,您可以设置视图控制器的工具栏
toolbarItems
属性,导航控制器将负责制作和配置标准工具栏。
implement viewFAorHeaderInSection delegate method of UITableView: 实现UITableView的viewFAorHeaderInSection委托方法:
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
{
UIView* customView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, tableView.frame.size.width, 90)];
customView.backgroundColor = [UIColor blackColor];
return customView;
}
and heightForFooterInSection 和heightForFooterInSection
- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section
{
return 80;
}
it should solove your problem. 它应该解决您的问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.