title: Accessing parent view controller (custom) properties
body: <p>I have written a <code>UITabBarController</code> subclass (called <code>MainViewController</code>) and added a few instance variables, specifically a venue of type Venue. Each tab of the <code>MainViewController</code> needs to access the venue variable of the <code>MainViewController</code>. In the first tab, a <code>UIViewController</code> subclass named <code>HomeViewController</code>, I wrote my <code>viewDidLoad</code> method and tried to output to NSLog with both...</p>
  
  <pre><code>NSLog(@"%@", self.parentViewController.venue.name);
  </code></pre>
  
  <p>and</p>
  
  <pre><code>NSLog(@"%@", self.tabBarController.venue.name);
  </code></pre>
  
  <p>But XCode gives the error</p>
  
  <pre><code>error: request for member 'venue' in something not a structure or union
  </code></pre>
  
  <p>I can access the venue property from within <code>MainViewController</code> just fine so have ruled out an error there. The iPhone simulator does see both <code>self.parentViewController</code> and <code>self.tabBarController</code> as an instance of <code>MainViewController</code>. The line...</p>
  
  <pre><code>NSLog(@"%@", self.tabBarController);
  </code></pre>
  
  <p>outputs...</p>
  
  <pre><code>2009-06-05 17:54:46.502 Venue[29729:20b] &lt;MainViewController: 0x536600&gt;
  </code></pre>
  
  <p>Since it's seen as a <code>MainViewController</code> instance, I doubt using casting would help. Is my only other option to initialize the <code>HomeViewController</code> with a copy of the venue or am I just doing something completely wrong with '<code>self.parentViewController.venue.name</code>'? Thanks, Rob</p>