【问题标题】:UIView inside UITableView does not show in runtimeUITableView 中的 UIView 在运行时不显示
【发布时间】:2013-05-17 19:00:54
【问题描述】:

我在故事板文件中有一个带有 UI 的 UITableViewController。我在 UITableView 上拖放了一个 UIView。它在 Interface Builder 中看起来很棒,但在运行时根本不显示:

关于如何解决的任何提示?

更新:我的项目大致基于本教程:https://devcenter.heroku.com/articles/ios-core-data-buildpack-app#add-new-tasks - 但其中一个区别是本教程使用的是 NIB 文件,而我有一个 Storyboard 文件。

【问题讨论】:

  • 应该可以,但它会随着表格向上滚动。你没在第一行上方看到它?
  • 不,如果我强行向下拖动表格,它只是白色的。
  • 何必用 UITableViewController,你可以使用 UIViewController + UIView + UITableView。
  • @danypata:也许这是要走的路,但它在本教程中确实有效:devcenter.heroku.com/articles/… - 我能看到的唯一区别是使用 NIB 文件而不是 Storyboard。跨度>
  • 我在情节提要中进行了尝试,我的场景中的对象列表看起来就像你的一样——我的工作正常,尽管在我旋转设备之前我无法滚动表格,这很奇怪。

标签: ios interface-builder uitableview xcode-storyboard


【解决方案1】:

尝试在viewDidLoad中使用bringToFront方法:

[tableView bringSubviewToFront:view];

【讨论】:

  • 谢谢,我已将[self.tableView bringSubviewToFront:self.activityInputView]; 添加到viewDidLoad,并在Interface Builder 中的UIView 和activityInputView @property 之间进行了拖放引用。但仍然没有显示。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2016-05-08
  • 1970-01-01
  • 2023-03-06
相关资源
最近更新 更多