UISearchDisplayController + NSFetchedResultsController update footerView

-(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];
}

So when [self.searchDisplayController.searchResultsTableView reloadData]; and self.fetchedResultsController= are executed, this method gets called:

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

The problem is, that i end up with 2 footer views. if i NSLog the table view when viewForFooter is called it logs this:

<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}>

So what i need is so only one footerView is visible.

链接地址: http://www.djcxy.com/p/36136.html

上一篇: NSFetchedResultsController对负数字符串值进行排序

下一篇: UISearchDisplayController + NSFetchedResultsController更新footerView