Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/112.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 强制特定NSFetchedResultsController部分到底部_Ios_Uitableview_Core Data_Nsfetchedresultscontroller - Fatal编程技术网

Ios 强制特定NSFetchedResultsController部分到底部

Ios 强制特定NSFetchedResultsController部分到底部,ios,uitableview,core-data,nsfetchedresultscontroller,Ios,Uitableview,Core Data,Nsfetchedresultscontroller,我想移动NSFetchedResultsController返回的一个特定部分,该部分放在底部。我想保持其他部分的排序顺序。是否有方法覆盖特定的顺序 以下是我创建的NSFetchedResultsController: - (NSFetchedResultsController *)fetchedResultsController { if (_fetchedResultsController != nil) { return _fetchedResultsControl

我想移动NSFetchedResultsController返回的一个特定部分,该部分放在底部。我想保持其他部分的排序顺序。是否有方法覆盖特定的顺序

以下是我创建的NSFetchedResultsController:

- (NSFetchedResultsController *)fetchedResultsController
{
    if (_fetchedResultsController != nil) {
        return _fetchedResultsController;
    }
    NSFetchRequest *fetchRequest = [[NSFetchRequest alloc] init];
    NSEntityDescription *entity = [NSEntityDescription entityForName:@"Object" inManagedObjectContext:self.managedObjectContext];
    [fetchRequest setEntity:entity];
    NSSortDescriptor *descriptor = [[NSSortDescriptor alloc] initWithKey:@"type" ascending:YES];
    [fetchRequest setSortDescriptors:[NSArray arrayWithObjects:teacherString, descriptor, nil]];
    NSString *downloadedString = @"Downloaded";
    fetchRequest.predicate = [NSPredicate predicateWithFormat:@"
status like[cd] %@",downloadedString];
    [fetchRequest setFetchBatchSize:20];
    _fetchedResultsController = [[NSFetchedResultsController alloc] initWithFetchRequest:fetchRequest
                                                                    managedObjectContext:self.managedObjectContext
                                                                      sectionNameKeyPath:@"title"
                                                                               cacheName:nil];
    _fetchedResultsController.delegate = self;
    self.fetchedResultsController = _fetchedResultsController;
    return _fetchedResultsController;
}
例如,我想让以U开头的标题始终显示在UITableView的底部,但仍然适当地响应新对象的插入


当我使用排序描述符时,它会先对节进行排序,然后对节中的行进行排序。

您是否检查了
NSSortDescriptor
的其他初始值设定项?我检查过,但我想我不明白添加比较器如何帮助解决此问题。一种方法是更改tableView(和FRC)委派方法来重新排列节的顺序:诀窍是为表构建不同的indexPath(使用
[NSIndexPath indexPathForRow:Insettion:
)。您需要仔细考虑从FRC indexPath到TV indexPath的映射,反之亦然,但这当然是可能的。您可以使用
tableView:titleForHeaderSection
如下所示: