我不会这么做的。我会将TTThumbsViewController子类化,并将SearchBar添加到该子类中。TTThumbsViewController没有内置的搜索功能,我应该考虑创建它。
另外,对于问题2,这通常是因为没有使用TTNavigator。TTThumbsViewController可能正在查找不存在的TTNavigator导航栏。您也可以在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()引起了问题。我不得不为自己的一个项目做这个。