У меня есть приложение, которое отображает довольно много данных в UITableView
. Я уже добавил UISearchBar
и UISearchDisplayController
в Interface Builder к UITableView
. Но я не знаю, как его использовать. Если бы кто-то мог быстро решить это, я был бы благодарен. Я просто требую, чтобы он работал по типу, чтобы найти совпадения поискового запроса в ячейках UITableView
(или из массива).
ОБНОВЛЕНИЕ 1. Здесь код из метода numberOfRowsInSection
:
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
if (isSearching) {
return [searchResults count];
}
else {
if (section == 0) {
return 1;
}
else if (section == 1) {
return [basicQuantities count];
}
else if (section == 2) {
return [physicalQuantities count];
}
}
return nil;
}