gpt4 book ai didi

ios - 使用 Interface Builder 将 UITableView 放在导航栏下方

转载 作者:行者123 更新时间:2023-11-29 10:27:39 27 4
gpt4 key购买 nike

我正在开发一个具有以下场景的 Storyboard :导航 Controller 具有 UITableViewController(父亲)。 Father 中有一个单元格执行 segue,打开一个新的 UIViewController:Son。在 Son 中,我拖了一个 UITableView 和一个 Navigation Item,因为我想在导航栏中有一个刷新按钮。

但是,当我运行该项目时,表格不适合导航栏下方。此外,它似乎是 View 页脚中的空白区域。我应该在界面构建器中设置或修改什么属性,让表格在导航栏之后开始,并填充整个 View ?

enter image description here

最佳答案

您无需手动将导航拖动到“子” Controller 。只需将 segue 的类型指定为“show”,您的“子” Controller 就应该从父 Controller 继承导航栏。

至于刷新按钮,您可以在代码中创建一个并将其添加到导航栏中,如下所示:

self.refreshButton=[[UIBarButtonItem alloc]initWithBarButtonSystemItem:UIBarButtonSystemItemRefresh target:self action:@selector(resetButtonTapped:)];self.navigationItem.rightBarButtonItem=self.refreshButton

关于ios - 使用 Interface Builder 将 UITableView 放在导航栏下方,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31345914/

27 4 0