如何在故事板中的 UITableViewController 底部添加工具栏? [英] How to add a toolbar to the bottom of a UITableViewController in Storyboards?
问题描述
在我使用 Storyboards 设置的 UITableView
中,我需要能够添加一个贴在视图底部的工具栏,它不应该滚动.
与这个问题不同:LINK 我不认为我可以将 TableView 子视图添加到普通视图,然后以编程方式添加工具栏,因为我使用的是动态单元格,这似乎更容易通过故事板集成.>
现在,这就是我所坚持的......
如果您想在放置在某个导航控制器中的一个视图控制器中显示工具栏.
- 在故事板中选择视图控制器
- 在实用程序中,显示属性检查器".选择底栏"样式.
- 添加栏按钮项
- 在视图控制器中添加代码,以显示和隐藏工具栏:
代码:
- (void)viewWillAppear:(BOOL)animated{[self.navigationController setToolbarHidden:NO 动画:YES];}- (void)viewWillDisappear:(BOOL)动画{[self.navigationController setToolbarHidden:YES 动画:YES];}
In my UITableView
that I have setup using Storyboards, I need to be able to add a tool bar that sticks to the bottom of the view, it should not scroll.
Unlike this question: LINK I don't think I could add a TableView subview to a normal view and then just add a toolbar programmatically because I am using dynamic cells which seem a lot easier to integrate via Storyboards.
For now, this is what I am stuck with....
if you want show toolbar in one view controller which placed in some navigation controller.
- select view controller in storyboard
- in utilities, show "attribute inspector". select "bottom bar" style.
- add bar button item
- add code in view controller, to show and hide toolbar:
code:
- (void)viewWillAppear:(BOOL)animated
{
[self.navigationController setToolbarHidden:NO animated:YES];
}
- (void)viewWillDisappear:(BOOL)animated
{
[self.navigationController setToolbarHidden:YES animated:YES];
}
这篇关于如何在故事板中的 UITableViewController 底部添加工具栏?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!