Hello guys, I 'm new to xcode. I try to select an image from the UIImagePickerController and then display this image pressing a button. But the simulator crashes. In the .h I use UIImage *dispimage; //in order to make a global image -(IBAction) open; -(IBAction) print;
In the .m I have - (void)viewDidLoad { self.imgPicker = [[UIImagePickerController alloc] init]; self.imgPicker.allowsImageEditing = YES; self.imgPicker.delegate = self; self.imgPicker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
}
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
{
dispimage = [info objectForKey:UIImagePickerControllerOriginalImage];
[self dismissModalViewControllerAnimated:YES];
}
-(IBAction) open{ UIImagePickerController *imagePicker = [[UIImagePickerController alloc] init]; imagePicker.delegate = self; [self presentModalViewController:imagePicker animated:YES]; [imagePicker release]; }; -(IBAction) print{ imageView.image=dispimage; };
When the button "print" is pressed, the sdk crashes. :( Any help would be appreciated
Thanks in advance