开发者

How to "transfer" UIImageView between view

开发者 https://www.devze.com 2023-01-30 05:09 出处:网络
when you click \"Share\" in my app you\'ll show an ActionSheet like this: Take photo Select photo from Library

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.

Ho开发者_如何学运维w 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

0

精彩评论

暂无评论...
验证码 换一张
取 消