Open solodyashkin opened 5 years ago
- (NSIndexPath *)indexPathForObject:(id)object { if ([object isKindOfClass:NSManagedObject.class]) { NSEntityDescription *entity = [(NSManagedObject*)object entity]; if ([entity isEqual:self.itemFetchRequest.entity]) { NSIndexPath *indexPath = [_nsFetchedResultsController indexPathForObject:object]; return [self convertNSFetchedResultsSectionIndexToUITableViewControllerSectionIndex:indexPath]; } else if ([entity isEqual:self.sectionFetchRequest.entity]) { NSUInteger objIdx = [self.sections indexOfObjectPassingTest:^BOOL(TASectionInfo *si, NSUInteger idx, BOOL * _Nonnull stop) { return si.theManagedObject == object; }]; if (objIdx != NSNotFound){ return [NSIndexPath indexPathWithIndex:objIdx]; } } } return nil; }