T
T
Timu4en2014-12-11 05:38:01
Objective-C
Timu4en, 2014-12-11 05:38:01

How to pass an image to another view?

Passing UiImageView.image to another view doesn't work. I tried many options and as a result, instead of a picture, I get a simple deletion (zeroing) of the second image.
This is how I get the image in the first view:

- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {
    
    UIImage *chosenImage = info[UIImagePickerControllerEditedImage];
    
    self.imageView.image = chosenImage;
    
    [picker dismissViewControllerAnimated:YES completion:NULL];
    
}

I'm trying to display it like this:
-(void) coolertt{
ViewController *secondView;
secondView.imageView.image= _imagePostView.image ;
}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
smanioso, 2014-12-11
@smanioso

Something strange in your code for the coolertt function - the imageView field is set to an uninitialized ViewController *. In principle, passing an image between two views is no different from passing ordinary data: www.appcoda.com/storyboards-ios-tutorial-pass-data...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question