UISearchbar没有传送正确的DetailView

时间:2012-10-22 18:21:17

标签: ios uisearchbar detailview

我搜索后的搜索栏并在我的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];


} 

0 个答案:

没有答案