Note that there are some explanatory texts on larger screens.

plurals
  1. POChanging a UIImageView's .image from another ViewController class
    primarykey
    data
    text
    <p>I have a <code>ViewController</code> which has an embedded <code>UIImageView</code>. Another <code>ViewController</code> has a button which should change the <code>UIImageView's</code> <code>.image</code> by click.</p> <p>What is the best way to achieve this?</p> <p>I've read something about a singleton class but:</p> <ul> <li>I'm not quite sure if I get the point of a <code>singleton class</code> correctly, maybe so. could explain it to me in easy words?</li> <li>There is a way using the <code>AppDelegate</code> ... but I think that's not the best solution.</li> </ul> <p>Thank you.</p> <p><strong>UPDATE:</strong></p> <p>Ich want to call the <code>setUpExternalDisplay</code>-method (which uses instance variables) in <code>FirstAssistantViewController</code>. My Code:</p> <p><code>FirstAssistantViewController.h</code></p> <pre><code>#import &lt;UIKit/UIKit.h&gt; #import "DetailTableViewController.h" @interface FirstAssistantViewController : UIViewController &lt;DetailTableViewControllerDelegate&gt; { DetailTableViewController * detailTableViewController; } </code></pre> <p><code>DetailTableViewController.h</code></p> <pre><code>#import "AssistantRootViewController.h" #import "FirstAssistantViewController.h" @protocol DetailTableViewControllerDelegate - (void) setUpExternalDisplay; @end @interface DetailTableViewController : UITableViewController &lt;UISplitViewControllerDelegate, UIActionSheetDelegate, DetailTableViewControllerDelegate&gt; { id &lt;DetailTableViewControllerDelegate&gt; delegate; } - (void)showModalHelpViewController; - (void)showModalAssistantViewController; @end </code></pre> <p><strong>UPDATE 2:</strong></p> <p>It now does the following error messages:</p> <p><code>Cannot find protocol declaration for 'DetailTableViewControllerDelegate'; did you mean 'UIPageViewControllerDelegate'?</code></p> <p><code>Property 'DTVCdelegate' requires method 'DTVCdelegate' to be defined - use @synthesize, @dynamic or provide a method implementation</code></p> <p>If I <code>@synthesize</code>:</p> <p><code>Existing ivar 'DTVCdelegate' for unsafe_unretained property 'DTVCdelegate' must be __unsafe_unretained</code></p> <p>Don't know how to solve it.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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