pickerView が文字列をデータ値として使用できるように、一連の Core Data オブジェクト (NSStrings) を NSMutableArray に追加しようとしています。
現在、textField の文字列を一度に 1 つずつコア データの sqlite ファイルに保存できます。
これらのオブジェクトを Core Data sqlite ファイルから NSMutable 配列に戻すのに問題があります。
これは、オブジェクトを sqlite ファイルに追加するコードです...
-(IBAction)addToPicker
{
CoreDataPickerAppDelegate *appDelegate = [[UIApplication sharedApplication] delegate];
NSManagedObjectContext *context = [appDelegate managedObjectContext];
NSManagedObject *thePerson = [NSEntityDescription insertNewObjectForEntityForName:@"Event" inManagedObjectContext:context];
[thePerson setValue:textField.text forKey:@"eventName"];
[context save:&error];
textField.text=@"";
self.viewDidLoad;
[textField resignFirstResponder];
}
今、私は...
- (void)viewDidLoad {
NSMutableArray *array = [[NSMutableArray alloc] init];
//code needed to send all the objects in the sqlite Core Data store into array to be read by the pickerView
self.pickerData = array; // the picker uses NSMutableArray pickerData for its data
[array release];
[super viewDidLoad];
}
どんな助けでも大歓迎です。クリス