Ios UISearchDisplayController+;NSFetchedResultsController更新页脚视图
所以当Ios UISearchDisplayController+;NSFetchedResultsController更新页脚视图,ios,uitableview,nsfetchedresultscontroller,uisearchdisplaycontroller,Ios,Uitableview,Nsfetchedresultscontroller,Uisearchdisplaycontroller,所以当[self.searchDisplayController.searchResultsTableView重新加载数据]和self.fetchedResultsController=,则调用此方法: -(void)setShowExcercisesType:(kShowExcercisesType)showExcercisesType{ _showExcercisesType=showExcercisesType; if(self.searchDisplayControlle
[self.searchDisplayController.searchResultsTableView重新加载数据]如果执行code>和self.fetchedResultsController=
,则调用此方法:
-(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];
}
问题是,我最终得到了两个页脚视图。如果我在调用viewForFooter时记录表格视图,它会记录以下内容:
- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section;
所以我需要的是只有一个footerView可见。如果(tableView==self.tableView)
@HAS,则只调用您的方法,但在这种情况下,原始表视图的获取结果控制器将不会更新。如果我们取消搜索,它将是旧的。
<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}>