Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>In this situation if you do not use dispatch_sync, you will get exactly what you need:</p> <pre><code>-(void)setUpWithView:(UIViewController*)viewController { containerController = [ContainerViewController sharedContainerController]; // Not using serial_queue and dispatch_sync [containerController initWithRootViewController:viewController];// line1 [containerController setUpView]; //line2 } </code></pre> <p>Line 1 will execute initWithRootViewController:, going deeper and executing lines</p> <pre><code>arrControllers = [[NSMutableArray alloc] init]; arrControllers = [NSMutableArray arrayWithObject:rootViewController]; </code></pre> <p>then it will return from this function one level above and proceed, moving to line 2 and going down to line</p> <pre><code>[self addChildViewController:[arrControllers lastObject]]; </code></pre> <p>ALSO. Never write code like this </p> <pre><code>arrControllers = [[NSMutableArray alloc] init]; arrControllers = [NSMutableArray arrayWithObject:rootViewController]; </code></pre> <p>First line creates an empty NSMutableArray and assigns a pointer to it into arrControllers. Second line creates another array (autoreleased) and assigns a pointer to it in arrControllers again. So a link to array created in the first line is lost and it is leaked under manual memory management.</p> <p>If you use manual memory management, do the following:</p> <pre><code>arrControllers = [[NSMutableArray alloc] init]; [arrControllers addObject:rootViewController]; </code></pre> <p>OR</p> <pre><code>arrControllers = [[NSMutableArray alloc] initWithObjects:rootViewController,nil]; </code></pre> <p>Under ARC leave only second line.</p> <p>Hope I understood you correctly. Feel free to ask questions.</p>
    singulars
    1. This table or related slice is empty.
    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. VO
      singulars
      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