从以下源文件,我尝试加载图像并保存到Core数据,并在imageView中显示,但它不起作用你可以帮我修复它.
- (IBAction)save:(id)sender
{
NSLog(@"Telling the AddTrackingTVC Delegate that save was tapped on the AddTrackingTVC");
[self.delegate theSaveButtonOnTheAddPlantNoteTVCWasTapped:self];
MyPlant *myTracking = [NSEntityDescription insertNewObjectForEntityForName:@"MyPlant" inManagedObjectContext:self.managedObjectContext];
myTracking.name = nameTextField.text;
myTracking.detail = detailTextField.text;
myTracking.createdDate = [NSDate date];
//myTracking.photo = [NSData ];
[self.managedObjectContext save:nil]; // write data to database
[self.delegate theSaveButtonOnTheAddPlantNoteTVCWasTapped:self];
}
- (IBAction)takePicture:(id)sender {
UIImagePickerController *imagePicker = [[UIImagePickerController alloc] init];
// If our device has a camera, we want to take a picture, otherwise, we // just pick from photo library
if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera]) …Run Code Online (Sandbox Code Playgroud)