问题
I'm trying to go from Camera Roll to a new view controller. So basically I want to be able to choose a picture and after choosing the picture, it will be displayed on an imageView on a new view controller? Is that hard to make ?
-(void) imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:
(NSDictionary *)info{
self.chosenImage = info[UIImagePickerControllerOriginalImage];
[self.imageView setImage:self.chosenImage];
[self dismissViewControllerAnimated:YES completion:nil];
}
-(void)imagePickerControllerDidCancel:(UIImagePickerController *)picker {
[self dismissViewControllerAnimated:YES completion:nil];
}
回答1:
in your image picker delegate methods, whenever you take image it goes in following method
-(void)imagePickerController:(UIImagePickerController *)picker
didFinishPickingImage : (UIImage *)image
editingInfo:(NSDictionary *)editingInfo
{
//store image here as NSData or as you like
// go to the view controller when you want to use image and use the image data
// do all the stuf you need in this method
}
来源:https://stackoverflow.com/questions/20063092/do-you-have-any-methods-for-going-from-cameraroll-to-a-new-view-controller