0
self.path = [self pathByCopyingFile:@"Notes List.plist"];
self.data = [[NSMutableDictionary alloc] initWithContentsOfFile:self.path];
self.notes = [self.data objectForKey:@"Notes"];
然後在一個按鈕(按鈕方法肯定會被調用):
NSString *title = self.navigationItem.title;
//Filter notes array by title
NSPredicate *pred = [NSPredicate predicateWithFormat:@"Title =[cd] %@", title];
NSArray * titleArray = [self.notes filteredArrayUsingPredicate:pred];
//delete all the notes with the old title name
[self.notes removeObject:titleArray];
NSLog(@"%@", self.notes);
在這一點上,self.notes仍包含項目我不知道他們爲什麼被剔除
因爲NSArray不可變嗎? http://stackoverflow.com/questions/7426570/remove-object-from-nsarray – Rob
我的「self.notes」是可變的 – user3001526