views:

59

answers:

0

I have only one fetchresult defined in application for displaying data in UiTableViewController. -> No Prob

I switch with tabcontrol to an other ViewController with one button. The button action modifies the fetchresults with NSPredicate. If i switch back, the list is updated. -> No Prob.

But if i use UISearchBar to change the fetchresults with an NSPredicate the tableview will not update and hang.

Whats wrong with this Code:

    - (void)searchBarSearchButtonClicked:(UISearchBar *)searchBar {
       [self requery];
    }

    -(void)requery {
       //get searchtext
        NSString *stxt= [searchBar text];

       // set new predicate 
        NSPredicate *pred = [NSPredicate predicateWithFormat:@"name like %@",stxt];
        myappdeleate.currentFilter = pred;
        [pred release];

        // reload fetchresult in appdelegate 
        [pred requery];

        // reload table data
        [self reloadData];

    }

Thanks