0

The my Searchbar after I searching and select row on my tableview is not conveyer for correct DetailView for row this is the code for UISearchbar

displayItems is NSMutableArray and allItems is NSArray

this the tutorial 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];


} 
4

0 回答 0