本文介绍了你有从CameraRoll到新的视图控制器的任何方法吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正试图从相机胶卷转到新的视图控制器。所以基本上我希望能够选择一张图片,选择图片后,它会显示在新视图控制器上的imageView上?那很难吗?

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];
}


推荐答案

,每当你拍摄图像时,它都按照以下方法进行

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
}

这篇关于你有从CameraRoll到新的视图控制器的任何方法吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-22 19:20