[英]How to Passing Uiimage from one view controller to Other view controller when using popvivew controller used?
I Have Two View controllers. 我有两个View控制器。
First UIViewController contain one UIImage, when I click "crop" button, go to second view controller I pass the image by push view controller, here I'am cropping my UIImage. 第一个UIViewController包含一个UIImage,当我单击“裁剪”按钮时,转到第二个视图控制器,我通过推式视图控制器传递图像,这里我裁剪了UIImage。
In second UIViewController after cropping my image, clicking "done" button, I need to pass the cropped image to first view. 裁剪图像后,在第二个UIViewController中,单击“完成”按钮,我需要将裁剪的图像传递到第一视图。
Problem is when I use pop-view controller, image is not passing. 问题是当我使用弹出视图控制器时,图像未通过。
1)Make a UIIMAGE *variable in first view controllers header. 1)在第一个视图控制器标头中设置UIIMAGE * variable。
2)set the uiimage variable from second view controller before popping. 2)在弹出之前从第二个视图控制器设置uiimage变量。
3)POP the second view controller. 3)POP第二个视图控制器。
If this is not working make a singleton class consisting of uiimage variable 如果这不起作用,则使一个由uiimage变量组成的单例类
Try like this. 尝试这样。 First view controller should have a property
第一视图控制器应具有一个属性
@property (assign)UIImage *croppedImage;
Second view controller should have 第二个视图控制器应具有
@property (assign)FirstViewController *first;
Before popping set 弹出集之前
first.croppedImage = self.image;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.