UISearchDisplayController + NSFetchedResultsController更新footerView

时间:2014-02-06 16:50:04

标签: ios uitableview nsfetchedresultscontroller uisearchdisplaycontroller

-(void)setShowExcercisesType:(kShowExcercisesType)showExcercisesType{
    _showExcercisesType=showExcercisesType;
    if(self.searchDisplayController.active){
        [self filterContentForSearchText:[self.searchDisplayController.searchBar text]
                                   scope:[self.searchDisplayController.searchBar selectedScopeButtonIndex]];
        [self.searchDisplayController.searchResultsTableView reloadData];
    }
    NSFetchRequest* bankRequest=[NSFetchRequest fetchRequestWithEntityName:@"Excercise"];
    //do some stuff with request depending on kShowExcercisesType
    self.fetchedResultsController=[[NSFetchedResultsController alloc]initWithFetchRequest:bankRequest managedObjectContext:self.managedObjectContext sectionNameKeyPath:nil cacheName:nil];
}

因此,当执行[self.searchDisplayController.searchResultsTableView reloadData];self.fetchedResultsController=时,会调用此方法:

- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section;

问题是,我最终得到2页脚的观点。如果我在调用viewForFooter时NSLog表视图,它会记录下来:

<UITableView: 0x15b4b800; frame = (0 64; 320 416); clipsToBounds = YES; opaque = NO; autoresize = W+H; gestureRecognizers = <NSArray: 0x14dbe040>; layer = <CALayer: 0x14e81750>; contentOffset: {0, 0}>
<UISearchResultsTableView: 0x15b4b400; frame = (0 0; 320 416); clipsToBounds = YES; autoresize = W+H; gestureRecognizers = <NSArray: 0x14ee8f60>; layer = <CALayer: 0x14ee88a0>; contentOffset: {0, -44}>

所以我需要的是只有一个footerView可见。

0 个答案:

没有答案