1
나는 NSFetchResultsController에서 객체 수를 제한하는 방법은 무엇입니까?
- (void)controllerWillChangeContent:(NSFetchedResultsController *)controller {
DLog(@"controllerWillChangeContent: %@", controller);
[self.tableViewA beginUpdates];
}
- (void)controller:(NSFetchedResultsController *)controller didChangeSection:(id <NSFetchedResultsSectionInfo>)sectionInfo
atIndex:(NSUInteger)sectionIndex forChangeType:(NSFetchedResultsChangeType)type {
DLog(@"didChangeSection: %@", controller);
switch(type) {
case NSFetchedResultsChangeInsert:
[self.tableViewA insertSections:[NSIndexSet indexSetWithIndex:sectionIndex] withRowAnimation:UITableViewRowAnimationFade];
break;
case NSFetchedResultsChangeDelete:
[self.tableViewA deleteSections:[NSIndexSet indexSetWithIndex:sectionIndex] withRowAnimation:UITableViewRowAnimationFade];
break;
}
}
- (void)controller:(NSFetchedResultsController *)controller didChangeObject:(id)anObject
atIndexPath:(NSIndexPath *)indexPath forChangeType:(NSFetchedResultsChangeType)type
newIndexPath:(NSIndexPath *)newIndexPath {
DLog(@"controller:%@\ndidChangeObject:%@\natIndexPath:%@\nforChangeType:%d\nnewIndexPath:%@\n",controller, anObject, indexPath, type, newIndexPath);
UITableView *tableView = self.tableViewA;
DLog(@"%@", self.tableViewA);
switch(type) {
case NSFetchedResultsChangeInsert:
[tableView insertRowsAtIndexPaths:[NSArray arrayWithObject:newIndexPath] withRowAnimation:UITableViewRowAnimationRight];
break;
case NSFetchedResultsChangeDelete:
[tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationRight];
break;
case NSFetchedResultsChangeUpdate:
[tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationNone];
[tableView insertRowsAtIndexPaths:[NSArray arrayWithObject:indexPath]withRowAnimation:UITableViewRowAnimationNone];
//[tableView reloadRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationNone];
break;
case NSFetchedResultsChangeMove:
[tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationRight];
[tableView insertRowsAtIndexPaths:[NSArray arrayWithObject:newIndexPath]withRowAnimation:UITableViewRowAnimationRight];
break;
}
}
- (void)controllerDidChangeContent:(NSFetchedResultsController *)controller {
[self.tableViewA endUpdates];
}
및 performFetch 전에 나는 평균의
request.fetchLimit = 100;
request.fetchBatchSize = 100;
내가 데이터 불과 100을 보여주고 싶은 사용 NSFetchedResultsControllerDelegate
사용 내가있는 tableView 에서을 데이터를 표시 할 필요가 NSFetchedResultsController을 가지고 있지만, NSManagedObjectContext가 변경 될 무언가를하면 NSFetchedResultsControllerDelegate를 호출하고 tableView에 모든 데이터를 삽입합니다. 문제가있는 tableView는
가 내가있는 tableView 100 개 이상의 데이터를 표시 할 수 없습니다 할 수있는 방법-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
id <NSFetchedResultsSectionInfo> sectionInfo = [[self.FetchController sections] objectAtIndex:section];
CalledRowCountingNotYetCallRowForSection=true;
[self.tableViewA setBounces:YES];
if([sectionInfo numberOfObjects]>100){
//[Timer searchCriteriaChanged];
CLog(@"Something Wrong This NumberOfRow: %d", [sectionInfo numberOfObjects]);
}
else{
}
return [sectionInfo numberOfObjects];
}
numberOfRowsInSection
을 설정하려면이 기능을 사용하여 100 개 이상의 데이터를 ... 보여줄 수있다?