UISearchDisplayController + NSFetchedResultsController更新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];
}

所以当[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是可见的。

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

上一篇: UISearchDisplayController + NSFetchedResultsController update footerView

下一篇: NSFetchedResultsController sorts in wrong order