0

我在表格视图中添加了一个 UINavigationBar。我知道这不是正确的方法,但我在想还有其他方法吗?当我试图将 UINavigationBar 和表视图放在视图控制器或表视图控制器中时,控制台会出现此错误:

Terminating app due to uncaught exception 'UIViewControllerHierarchyInconsistency',
reason: 'A view can only be associated with at most one view controller at a time!
View <UITableView: 0x1ebfb200; frame = (0 0; 320 480); clipsToBounds = YES; opaque
= NO; autoresize = W+H; gestureRecognizers = <NSArray: 0x1e5a0500>; layer =
<CALayer:0x1e5a94f0>; contentOffset: {0, 0}> is associated with <UITableViewController: 0x1e59f8c0>.
Clear this association before associating this view with <SheetsSavedViewController: 0x1f879660>.'

现在,当我滚动时,导航栏会随着表格视图移动。有什么办法可以将其锁定在顶部吗?或者修复上面的错误...

4

2 回答 2

0
  • 在 stroyboard 中选择您的 tableView 控制器
  • 编辑器 -> 嵌入 -> 导航控制器
于 2012-12-18T05:58:39.310 回答
0

为什么不使用文件菜单中的菜单选项将整个表格视图控制器嵌入到导航视图中。

于 2012-12-17T23:03:45.537 回答