Snipt.net is closing on December 31st, 2016

For more information, please visit this blog post.

snipt

Ctrl+h for KB shortcuts

Objective-C

How to access global variables required in your application

YourAppDelegate *appDelegate = (YourAppDelegate *)[[UIApplication sharedApplication] delegate];
//and then access the variable by appDelegate.variable
https://snipt.net/embed/c51551240be94ef132a740bfa1b09932/
https://snipt.net/raw/c51551240be94ef132a740bfa1b09932/
c51551240be94ef132a740bfa1b09932
objective-c
Objective-C
2
2016-12-09T05:47:07
True
False
False
/api/public/snipt/28781/
how-to-access-global-variables-required-in-your-application
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="n">YourAppDelegate</span> <span class="o">*</span><span class="n">appDelegate</span> <span class="o">=</span> <span class="p">(</span><span class="n">YourAppDelegate</span> <span class="o">*</span><span class="p">)[[</span><span class="bp">UIApplication</span> <span class="n">sharedApplication</span><span class="p">]</span> <span class="n">delegate</span><span class="p">];</span> </span><span id="L-2"><a name="L-2"></a><span class="c1">//and then access the variable by appDelegate.variable</span> </span></pre></div> </td></tr></table>
controllers, performance
Copyrighted, illegal, or inappropriate content? Email [email protected].