Note that there are some explanatory texts on larger screens.

plurals
  1. POMultiple UIViewController working at the same time?
    primarykey
    data
    text
    <p>Is the possible for multiple UIViewControllers working at the same time? Consider the following window:</p> <pre><code> +-----------------+ | +-----+ | | | | | | | A | C | | | | | | +-----+ | | | | +-----+ | | | B | | | +-----+ | | | +-----------------+ </code></pre> <p><code>C</code> is the first UIViewController added to the window. </p> <p>In viewDidLoad of C_ViewController, I added a NIB (A) by:</p> <pre><code>A_ViewController *avc = [[A_ViewController alloc] initWithNibName:@"A_ViewController" bundle:nil]; [self.view addSubview:avc.view]; [avc release]; </code></pre> <p>A_ViewController is loaded and shown properly. However, if linking any event from the A_ViewController.xib to IBOutlet in A_ViewController.m (e.g. buttonClick), there is an error when the event is fired:</p> <blockquote> <p>*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSCFString buttonClicked:]: unrecognized selector sent to instance 0x5937a40'</p> </blockquote> <p>The question, is it possible to have multiple UIViewController working at the same time? In this example, one for <code>C</code>, one for <code>A</code> and one for <code>B</code>.</p> <p>ADDED: the header file of C_ViewController</p> <pre><code> @class A_ViewController; @interface C_ViewController : UIViewController { A_ViewController *avc; } @property (nonatomic, retain) IBOutlet A_ViewController *avc; @end </code></pre> <p>SOLUTION:</p> <pre><code> A_ViewController *a = [[A_ViewController alloc] initWithNibName:@"A_ViewController" bundle:nil]; [self.view addSubview:a.view]; self.avc = a; // added this to fix!! Thanks [a release]; </code></pre>
    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.
    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