Do you have any methods for going from CameraRoll to a new view controller?

扶醉桌前 提交于 2019-12-02 14:37:55

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!