Reputation: 30143
I would like to layout a TTSearchBar
above above a TTThumbsViewController
. My current (failing) attempt involves my own SearchViewController
that inherits from TTViewController
and contains a reference to a TTThumbsViewController
and TTSearchBar
. In the loadView
method, I instantiate both TTThumbsViewController
and TTSearchBar
and add them (actually, ..the view
property of the TTTVC) as subviews. When the SearchViewController
is pushed, neither the TTThumbsViewController
nor the TTSearchBar
are displayed.
I've just follwed the instructions at question #2601484 and gotten to same place as question #2614079.
Am I going about this wrong? Is there a better way to add search to the TTThumbsViewController
?
Upvotes: 0
Views: 652
Reputation: 6126
That's not how I'd go about it. I would subclass TTThumbsViewController and add the SearchBar to that subclass. There's no built-in search for TTThumbsViewController, I should look into creating that.
Also, for problem #2, that's usually a result of not using TTNavigator. The TTThumbsViewController is likely looking for the TTNavigator NavigationBar which doesn't exist. You can fix that in your TTThumbsViewController subclass as well by overriding things like:
- (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());
}
It's likely the TTBarsHeight() that's causing problems. I had to do this for one of my own projects.
Upvotes: 1