我搜索后的搜索栏并在我的tableview上选择行不是传送器,因为正确的DetailView for row这是UISearchbar的代码
displayItems是NSMutableArray,allItems是NSArray
这个教程http://www.youtube.com/watch?v=IqDZHgI_s24
-(void)searchBar:(UISearchBar *)searchBar textDidChange:(NSString *)searchText{
if ([searchText length] == 0) {
[displayItems removeAllObjects];
[displayItems addObjectsFromArray:allItems];
} else {
//here
[displayItems removeAllObjects];
for (NSString * string in allItems){
NSRange r =[string rangeOfString:searchText options:NSCaseInsensitiveSearch];
if (r.location != NSNotFound){
[displayItems addObject:string];
}
}
}
[tableView reloadData];
}