Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The issue is that you're creating this controller in your <code>main</code> function, but don't do anything with it and it will fall out of scope (and if using ARC, will be deallocated). Regardless, when the view controller is instantiated during the standard flow of the app, it will create a second instance, this time without having <code>createButton</code> called. So your calling of <code>createButton</code> in <code>main</code> is for naught. This concept of "I create an object in main class just to start it quickly" doesn't pass muster. The creating of the view controller in <code>CreateButtons</code> suffers from an analogous problem.</p> <p>You really need to set the <code>stream</code> property somewhere else (e.g. in the <code>viewDidLoad</code> of <code>PlayVideoController</code> or in the <code>prepareForSegue</code> of the view controller that is segueing to <code>PlayVideoController</code>). But you almost certainly will never call <code>initWithString</code> for <code>PlayVideoController</code> (and you probably can retire that method). </p> <p>If, for example, you're transitioning from <code>ButtonsController</code> view controller to <code>PlayVideoController</code> view controller via a segue with a storyboard identifier of, say <code>playVideo</code>, then you could use <code>prepareForSegue</code> in <code>ButtonsController</code> like so:</p> <pre><code>#import "PlayVideoController.h" - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { if([segue.identifier isEqualToString:@"playVideo"]){ PlayVideoController *controller = (PlayVideoController *)segue.destinationViewController; controller.stream = @"--somestring--"; } } </code></pre> <p>(See the "Passing data forward using segues" section of <a href="https://stackoverflow.com/a/9736559/1271826">this answer about passing data between controllers</a>.)</p> <p>If you want to do something at startup, e.g. initialize some model object structure (but not view controllers), you can do that in your app delegate's <code>didFinishLaunchingWithOptions</code>, but there's nothing shared with us thus far that seems to suggest that this is necessary. But if you do this, make sure you do the necessary memory management to keep it around (e.g. make this model object a property of the app delegate, make it a singleton, etc.). But if you create a local variable and configure it and let it fall out of scope, you'll lose the work you did on that.</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.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. 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