title: How to change value in UISegmentedControl?
body: <p>I have set up a segmented control in my project. I want to use it in my settings scene to control whether the orientation is landscape left or landscape right.  I have in set up in my storyboard and here is my code in my SettingsViewController.h</p>
  
  <pre><code>#import &lt;UIKit/UIKit.h&gt;
  
  @interface SettingsViewController : UIViewController
  {
      IBOutlet UISegmentedControl *orientation;
  }
  
  @property (nonatomic, retain) UISegmentedControl *orientation;
  
  - (IBAction) setOrientation;
  
  @end
  </code></pre>
  
  <p>and here is my code in SettingsViewController.m</p>
  
  <pre><code>#import "SettingsViewController.h"
  
  @implementation SettingsViewController
  
  @synthesize orientation;
  
  
  - (IBAction)setOrientation
  {
      NSLog(@"index = %d\n", orientation.selectedSegmentIndex);
      if (orientation.selectedSegmentIndex == 0) {
          NSLog(@"left\n");
      }
      if (orientation.selectedSegmentIndex == 1) {
          NSLog(@"right\n");
      }
  
  }  
  
  
  
  - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
  {
      self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
      if (self) {
          // Custom initialization
      }
      return self;
  }
  
  - (void)viewDidLoad 
  {
      [super viewDidLoad];
  
  }
  
  - (void)viewDidUnload
  {
      [super viewDidUnload];
      // Release any retained subviews of the main view.
  }
  
  @end
  </code></pre>
  
  <p>I was wondering why the value isn't changing from 0 to 1 when I select the right side of the control.  Also I was wondering if in my .h I need to declare IBOutlet because I dont use the segmented control as an outlet. I just use it to take in which side is selected and then use that to set the orientation of the app.</p>