get image from previous controller
i am getting a picture from the iPhone's camera in one nib file (getPhoto.xib)开发者_StackOverflow, where I save it into the camera library and also display it in an UIImageView (image1). Then, I have a next button which loads a different nib file (naming.nib) where the user can add a name for the image. How I can access the image from the first nib file so that I can display it in an UIImageView
(image2) in the second nib file?
I'm trying the following, but nothing is displayed in image2:
UIImageView *image2= [[UIImageView alloc initWithImage:
[UIImageView imageNamed:image1]];
the imageNamed
: method requires an NSString
argument. Assuming that the name of image1
is actually "image1", you would do:
UIImageView *image2 = [[UIImageView alloc]
initWithImage:[UIImageView imageNamed:@"image1"]];
Note that the "name" here is the name you used when saving the image to the camera library.
call retain on image1 (the one you get from camera) and use it where ever u are currently trying to use image2
精彩评论