我正在使用类似于苹果的核心数据配方示例代码的应用程序。我希望能够从详细视图中删除条目,就像苹果的联系人应用程序一样。
下面的代码是删除第一个条目而不是选定的条目。不知道我做错了什么。
NSIndexPath *indexPath = [myTableView indexPathForSelectedRow];
NSManagedObjectContext *context = [fetchedResultsController managedObjectContext];
[context deleteObject:[fetchedResultsController objectAtIndexPath:indexPath]];
[myTableView reloadData];