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

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

问题描述

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

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. 在故事板中选择视图控制器

  2. 在实用程序中,显示属性检查器。选择底栏样式。

  3. 添加栏按钮项

  4. 在视图控制器中添加代码,以显示和隐藏工具栏:

  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:

代码:

- (void)viewWillAppear:(BOOL)animated
{
    [self.navigationController setToolbarHidden:NO animated:YES];
}

- (void)viewWillDisappear:(BOOL)animated
{
    [self.navigationController setToolbarHidden:YES animated:YES];
}

这篇关于如何在Storyboards中的UITableViewController底部添加工具栏?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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