You might implement this method if you want to perform an asynchronous search. You would initiate the search in this method, then return NO. You would reload the table when you have results.
Showing posts with label UISearchDisplayController. Show all posts
Showing posts with label UISearchDisplayController. Show all posts
Monday, February 14, 2011
UISearchDisplayController with No Results
Don't know what it is, but I just can't make UISearchDisplayDelegate shouldReloadTableForSearchString method work the way I read the documentation:
Labels:
async,
BOOL,
NSLog,
shouldReloadTableForSearchString,
UISearchBarBackground,
UISearchDisplayController,
UISearchDisplayDelegate,
UITableView
Thursday, October 14, 2010
How to Control UISearchBar Background Color
When you have a list, you want to search it. How would you do that? No, don't code it by yourself. Done it, removed it.
By default each UITableView comes with search support via a built-in UISearchDisplayController. You just add and connect UISearchBar to your table in Interface Builder and provide some delegate methods to make it work. Pretty easy:
You can fix that by doing two things. First get rid of default background:
Sad to think how many hours I wasted experimenting Things That Will Not Work, just to find out that kind of miniscule solution. Also bet that this will not work one year from now...
By default each UITableView comes with search support via a built-in UISearchDisplayController. You just add and connect UISearchBar to your table in Interface Builder and provide some delegate methods to make it work. Pretty easy:
self.searchDisplayController.delegate =Controlling how your UISearchBar looks like is a bit more difficult. If you want to show search box and some other component(s) side by side, you can do it by putting UIToolbar at back and a short UISearchBar on top of it. By default their backgrounds are different, looking pretty ugly together. Like a hack, what it really is.
self.searchDisplayController.searchBar.delegate =
self.searchDisplayController.searchResultsDataSource =
self.searchDisplayController.searchResultsDelegate = self.mySearchObject;
You can fix that by doing two things. First get rid of default background:
for (UIView *view in self.searchBar.subviews)...and the second thing? Something that will be extremely hard to find out, unless you get it right by accident? You have to set UISearchBar style Black Translucent!
{
if ([view isKindOfClass:NSClassFromString
(@"UISearchBarBackground")])
{
[view removeFromSuperview];
break;
}
}
Sad to think how many hours I wasted experimenting Things That Will Not Work, just to find out that kind of miniscule solution. Also bet that this will not work one year from now...
Labels:
delegate,
interface builder,
isKindOfClass,
NSClassFromString,
UISearchBarBackground,
UISearchDisplayController,
UITableView,
UIToolbar,
UIView
Subscribe to:
Posts (Atom)