- Java 双重比较
- java - 比较器与 Apache BeanComparator
- Objective-C 完成 block 导致额外的方法调用?
- database - RESTful URI 是否应该公开数据库主键?
Objective-C method 'controller:didChangeObject:atIndexPath:forChangeType:newIndexPath:' provided by method 'controller(:didChangeObject:atIndexPath:forChangeType:newIndexPath:)' conflicts with optional requirement method 'controller(:didChangeObject:atIndexPath:forChangeType:newIndexPath:)' in protocol 'NSFetchedResultsControllerDelegate'
func controller(controller: NSFetchedResultsController, didChangeObject anObject: NSManagedObject, atIndexPath indexPath: NSIndexPath?, forChangeType type: NSFetchedResultsChangeType, newIndexPath: NSIndexPath?) {
if self.collectionView?.window == nil {
return
}
let change = NSMutableDictionary()
switch(type)
{
case .Insert:
change[NSNumber(unsignedLong:type.rawValue)] = newIndexPath
case .Delete:
change[NSNumber(unsignedLong:type.rawValue)] = indexPath
case .Update:
change[NSNumber(unsignedLong:type.rawValue)] = indexPath
case .Move:
change[NSNumber(unsignedLong:type.rawValue)] = NSArray(objects: indexPath!, newIndexPath!)
default:
break
}
self.objectChanges?.addObject(change)
}
最佳答案
看起来正确的方法签名是:
func controller(controller: NSFetchedResultsController, didChangeObject anObject: AnyObject, atIndexPath indexPath: NSIndexPath?, forChangeType type: NSFetchedResultsChangeType, newIndexPath: NSIndexPath?) {
}
解决这些问题的任何简单方法是允许 Xcode 自动完成方法签名。然后,用自动生成的签名替换您的方法的签名。为此,您只需在定义方法时键入 controller
即可查看所有匹配方法的列表。
关于ios - Objective-C 方法' Controller :didChangeObject:atIndexPath:forChangeType:newIndexPath,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32790733/
我正在做一个搜索栏,当您输入“nike”一词时,它必须显示自定义单元格“shop Types”,该单元格的标题中包含该名称,而且还包含品牌 nike(如果品牌数组中存在该品牌)。 目前我设法在表格 V
在 View 加载后,我必须在我的 UITableView 中选择一行。 所以我做了: [self.tableView selectRowAtIndexPath:[NSIndexPath index
我通过以下方式设置标题大小: if let flowLayout = self.myCollectionView.collectionViewLayout as? UICollectionViewFl
直到几天前,我还用 UITableViewCell 编写所有内容 - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowA
我有一个 Collection View ,我希望每个部分都有页眉和页脚。我正在使用默认流布局。 我有自己的 UICollectionReusableView 子类,我在 View Controlle
我有一个 UITableView,它有几个不同高度的单元格。每一行都根据其包含的内容进行动态调整。 我有一个自定义的 UITableViewCell,里面有一个 UICollectionView,它应
我在请求中使用 NSFetchedResultsController 和 sortDescriptors 来填充包含大量结果的表。我注意到,当发生将行从表底部附近移动到顶部的更改时,根本不会调用 di
我需要使用模型对象的内容配置自定义表格 View 单元格。哪个是首选的设计模式?我不是在寻找“正确”的答案,只是对利弊的良好讨论。 1)在configureCell:atIndexPath:?中手动配
Objective-C method 'controller:didChangeObject:atIndexPath:forChangeType:newIndexPath:' provided by
我在 TableView 单元格中有 Collection View ,并且我使用 Nib 作为我的 Collection View 单元格(其中我对 ImageView 和标签使用自动布局,并且它处
我是一名优秀的程序员,十分优秀!