0

我想在 aTTSearchBar上方布局 a TTThumbsViewController。我当前(失败)的尝试涉及我自己的SearchViewController,它继承自TTViewController并包含对 a TTThumbsViewControllerand的引用TTSearchBar。在该loadView方法中,我将两者都实例化TTThumbsViewControllerTTSearchBar添加它们(实际上是..TTTVCview的属性)作为子视图。按下时SearchViewController,既不显示TTThumbsViewController也不TTSearchBar显示。

我刚刚按照问题 #2601484 中的说明进行操作,并到达与问题#2614079相同的位置。

我要解决这个问题了吗?有没有更好的方法来添加搜索TTThumbsViewController

4

1 回答 1

1

我不会那样做的。我会将 TTThumbsViewController 子类化并将 SearchBar 添加到该子类。TTThumbsViewController 没有内置搜索,我应该考虑创建它。

此外,对于问题 #2,这通常是未使用 TTNavigator 的结果。TTThumbsViewController 可能正在寻找不存在的 TTNavigator NavigationBar。您也可以通过覆盖以下内容在您的 TTThumbsViewController 子类中修复它:

- (void)updateTableLayout {
  self.tableView.contentInset = UIEdgeInsetsMake(TTBarsHeight()+4, 0, 0, 0);
  self.tableView.scrollIndicatorInsets = UIEdgeInsetsMake(TTBarsHeight(), 0, 0, 0);
}

// TTTableViewController
- (CGRect)rectForOverlayView {
  return TTRectContract(CGRectOffset([super rectForOverlayView], 0, TTBarsHeight()-_tableView.top),
                        0, TTBarsHeight());
}

这可能是导致问题的 TTBarsHeight() 。我必须为我自己的一个项目这样做。

于 2010-04-14T21:19:13.843 回答