简体   繁体   中英

How to “transfer” UIImageView between view

when you click "Share" in my app you'll show an ActionSheet like this:

  • Take photo
  • Select photo from Library
  • Cancel

You tap "Take photo" and you'll see an ImagePicker, with "presentModalViewController". You take a photo and you select "OK" in the ImagePicker. Here, I want the photo just taken in a new view with other label. Like this:

(new view) Little photo (just taken) - Label 1 (ex. Title of photo) - Label 2 (ex. Location of photo)

and a button "Share" for sharing your photo and its infos.

How can I do this? I'm stopped after take the photo. How can I send my photo (in a imageview) to another view?

Thanks

for this,

make some global varible in appDelegate class and make them property.

for saving Image make UIImage object in app delegate and for title and path make string variables and make all these : property then.

then when you select image from modelView at the selection time you must set app delegate properties(image,title,path).and navigate to other page and on viewWillAppear of new page

set your controls (ImageView and labels) by these objects.

I hope, it helps you. You need to code this logic.

Some one already suggested for that by using appDelegate.

you can do in other way too.

just declare some variable like imagePath and imageTitle in the 2nd view controller. and set property to them like

@property (nonatomic,retain) NSString *imagePath;

And then in the 1st view controller access those variables like

secondViewControllerObj.imagePath = @"Give Image Path Here";

then you can access the imagePath in the 2nd View Controller as self.imagePath

Regards,

Satya

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM