如何在故事板中的 UITableViewController 底部添加工具栏? [英] How to add a toolbar to the bottom of a UITableViewController in Storyboards?

查看:27
本文介绍了如何在故事板中的 UITableViewController 底部添加工具栏?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我使用 Storyboards 设置的 UITableView 中,我需要能够添加一个贴在视图底部的工具栏,它不应该滚动.

与这个问题不同:LINK 我不认为我可以将 TableView 子视图添加到普通视图,然后以编程方式添加工具栏,因为我使用的是动态单元格,这似乎更容易通过故事板集成.>

现在,这就是我所坚持的......

解决方案

如果您想在放置在某个导航控制器中的一个视图控制器中显示工具栏.

  1. 在故事板中选择视图控制器
  2. 在实用程序中,显示属性检查器".选择底栏"样式.
  3. 添加栏按钮项
  4. 在视图控制器中添加代码,以显示和隐藏工具栏:

代码:

- (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.

  1. select view controller in storyboard
  2. in utilities, show "attribute inspector". select "bottom bar" style.
  3. add bar button item
  4. 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屋!

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