11
當我生成CoreData實體我的課我得到生成的方法CoreDataGeneratedAccessors - removeObject刪除對象嗎?
@interface Site (CoreDataGeneratedAccessors)
- (void)addSearchesObject:(Search *)value;
- (void)removeSearchesObject:(Search *)value;
- (void)addSearches:(NSSet *)value;
- (void)removeSearches:(NSSet *)value;
@end
所以我的問題是非常簡單的,當我打電話removeSearchesObject:myObject的我一定要刪除它嗎?
[site removeSearchesObject:[[fetchedResultsController fetchedObjects] objectAtIndex:indexPath.section]];
[context deleteObject:[[fetchedResultsController fetchedObjects] objectAtIndex:indexPath.section]];
這裏是生成的代碼(從doc)
- (void)removeEmployeesObject:(Employee *)value
{
NSSet *changedObjects = [[NSSet alloc] initWithObjects:&value count:1];
[self willChangeValueForKey:@"employees"
withSetMutation:NSKeyValueMinusSetMutation
usingObjects:changedObjects];
[[self primitiveEmployees] removeObject:value];
[self didChangeValueForKey:@"employees"
withSetMutation:NSKeyValueMinusSetMutation
usingObjects:changedObjects];
[changedObjects release];
}
謝謝!這是我相信的 – Fsdn 2009-11-11 12:02:26