title: If I add a control programmatically in viewDidLoad, how do I access it from other methods?
body: <p>In my viewDidLoad method of my main View Controller I programatically create a segmented control and then add it to the titleView of my Navigation Control.  </p>
  
  <pre><code>NSArray *seggieItems = [[NSArray alloc] initWithObjects:@"See Entire List",@"See Near Me", nil];
  UISegmentedControl *seggie = [[UISegmentedControl alloc]initWithItems:seggieItems];
  [seggie setSegmentedControlStyle:UISegmentedControlStyleBar];
  [seggie setTintColor:[UIColor redColor]];
  [seggie addTarget:self
             action:@selector(seggieChanged:)
   forControlEvents:UIControlEventValueChanged];
  
  
  self.navigationItem.titleView = seggie;
  </code></pre>
  
  <p>However when I want to access this Segmented Control from another method, such as viewWillAppear, I can't - it's an undeclared identifier.</p>
  
  <pre><code>    - (void)viewWillAppear:(BOOL)animated
  {
      [super viewWillAppear:animated];
      [seggie setSelectedSegmentIndex:0]; //this should always be 0 for this view controller viewDidLoad method
  
  }
  </code></pre>
  
  <p>If I was using a XIB this would be no problem since I'd have an IBOutlet I could use from anywhere.  I tried creating a property for my Segmented control, but then the instance variable hides the local variable, so this must be the wrong approach.  </p>
  
  <p>What's the best way to go about this?  I apologize if this is a stupid question - I'm fairly new to iOS, currently about halfway through a couple of books.  I couldn't find an answer on Google or searching StackOverflow.  I would appreciate any help, and I'm sorry if this is something really simple that I'm missing.  Thanks</p>