title: Call a function from another Class - Obj C
body: <p>I'm trying to figure out how I can call a function from another one of my classes. I'm using a RootViewController to setup one of my views as lets say AnotherViewController</p>
  
  <p>So in my AnotherViewController im going to add in on the .h file</p>
  
  <pre><code>@class RootViewController
  </code></pre>
  
  <p>And in the .m file im going to import the View</p>
  
  <pre><code>#import "RootViewController.h"
  </code></pre>
  
  <p>I have a function called:</p>
  
  <pre><code>-(void)toggleView {
  //do something }
  </code></pre>
  
  <p>And then in my AnotherViewController I have a button assigned out as:</p>
  
  <pre><code>    -(void)buttonAction {
  //}
  </code></pre>
  
  <p>In the buttonAction I would like to be able to call the function toggleView in my RootViewController.</p>
  
  <p>Can someone clarify on how I do this.</p>
  
  <p>I've tried adding this is my buttonAction:</p>
  
  <pre><code>RootViewController * returnRootObject = [[RootViewController alloc] init];
      [returnRootObject toggleView];
  </code></pre>
  
  <p>But I dont think that's right.</p>