Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>You can pass the image from one view controller to other view controller in many ways,Out of which some are listed below</p> <ol> <li><p>In the app delegate create one imageview object.Declare property &amp; synthesize of it to access it in other classes. Now Create App delegate share instance &amp; set the image view object of app delegate in captureButton method of second view controller. To access the same image again create shared instance of app delegate file in first view controller and use the app delegate image view property to get the image.</p></li> <li><p>Second way is by using the delegates methods</p> <pre><code> //Declare delegate in second view controller @protocol SecondViewControllerDelegate -(void)setTheImage:(UIImage *)img @end //Declare property of delegate protocol @property (assign)id&lt;SecondViewControllerDelegate&gt; delegate; //synthesize the variable @synthesize delegate; //Extend SecondViewControllerDelegate in first view controller by importing secondviewController in first view controller #import secondviewController.h @interface firstviewController : UIViewController&lt;SecondViewControllerDelegate&gt; </code></pre> <p>// Now wherever you are creating object of SecondViewController set the delegate as follows lets say objSecondViewController is object of your view controller</p> <pre><code>objSecondViewController.delegate=(id)self; //Now define delegate method of SecondViewControllerDelegate -(void)setTheImage:(UIImage *)img { //here set the image img to your image view present in first view controller } //Now lastly in second view controller in captureButton function call the function [delegate captureButton:currImage]; </code></pre></li> <li><p>Third way is to use the global declaration of the first view controller &amp; set the image view in the captureButton by declaring the property &amp; synthesize of imageview of first view controller</p></li> </ol>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload