我有一個NSArray的字符串,我想添加一定數量的行到大綱視圖取決於有多少個字符串在數組中,每個字符串的標題加入。添加到NSArray的核心數據模型
我認爲這將涉及循環這樣的數組。
for(NSString *title in array) {
JGManagedObject *theParent =
[NSEntityDescription insertNewObjectForEntityForName:@"projects"
inManagedObjectContext:managedObjectContext];
[theParent setValue:nil forKey:@"parent"];
[theParent setValue:@"Project" forKey:@"name"];
[theParent setValue:[NSNumber numberWithInt:0] forKey:@"position"];
}
你確定你的意思是設置一個字符串說「零」作爲父親的父親的價值,而不是'nil'本身? – 2009-09-26 15:44:52
哦。感謝您的注意。我的意思是「無」。 – Joshua 2009-09-26 16:11:12
correct @「nil to nil – Abizern 2009-09-26 16:30:09