title: iPhone: adding segmented control to toolbar instead of buttons within navigation controller?
body: <p>im new to iphone programming so if you could help me out I would appreciate it- i have been all over the web and cant find the answer to this.</p>
  
  <p>my current setup is like this</p>
  
  <p>navigation controller in MainWindow.xib > View in navigation controller in MainWindow.xib calls RootViewController.xib > RootViewController.xib contains a single tableview.</p>
  
  <p>i can then load in a toolbar using the following code in RootViewController.m</p>
  
  <pre><code>UIBarButtonItem *buttonOne = [[UIBarButtonItem alloc] initWithTitle:@"One" 
       style:UIBarButtonItemStyleBordered target:self action:@selector(buttonOnePushed)];
  UIBarButtonItem *buttonTwo = [[UIBarButtonItem alloc] initWithTitle:@"Two" 
       style:UIBarButtonItemStyleBordered target:self action:@selector(buttonTwoPushed)]; 
  
  NSArray *barArray = [NSArray arrayWithObjects: buttonOne, buttonTwo, nil];
  [buttonOne release];
  [buttonTwo release];
  
  [self setToolbarItems:barArray animated:YES];
  
  [self.navigationController setToolbarHidden:NO animated:YES];
  </code></pre>
  
  <p>this code works for buttons. but i cannot for the life of me find out how to add a segmented control instead of the buttons. i have tried an array with two segmented controls in it, but then can't add the array to the toolbar.</p>
  
  <p>if anyone could let me know some code that will add segmented controls in the same fashion as i have used to add the buttons i would greatly appreciate it.</p>
  
  <p>thanks, dave.</p>