I am trying to have a bunch of Core Data objects (NSStrings) be added to an NSMutableArray so that I pickerView can use the strings as its data values.
Currently I am able to save strings from a textField one at a time into the sqlite file, in Core Data.
I am having trouble pulling those Objects back out of the Core Data sqlite file and into a NSMutable array.
This is the code to add objects to the sqlite file...
-(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];
}
Right now I have...
- (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];
}
any help would greatly be appreciated. Chris