title: How to disable part of UISegmentedControl?
body: <p>Following is the code for <code>UISegmentedControl</code></p>
  
  <pre><code>UISegmentedControl *segmentedControl = [[UISegmentedControl alloc] initWithItems:[NSArray arrayWithObjects: [UIImage imageNamed:@"down.png"], [UIImage imageNamed:@"dList.png"], nil]];  
  
  [segmentedControl addTarget:self action:@selector(segmentAction:) forControlEvents:UIControlEventValueChanged];  
  segmentedControl.frame = CGRectMake(0, 0, 90, 65);  
  segmentedControl.segmentedControlStyle = UISegmentedControlStyleBar;  
  segmentedControl.momentary = YES;  
  
  UIBarButtonItem *segmentBarItem = [[UIBarButtonItem alloc] initWithCustomView:segmentedControl];  
  
  [segmentedControl release];  
  
  self.navigationItem.rightBarButtonItem = segmentBarItem;  
  
  [segmentBarItem release];    
  </code></pre>
  
  <p>and   </p>
  
  <pre><code>- (void)segmentAction:(id)sender{
      if([sender selectedSegmentIndex] == 0)
      {
          button.hidden=NO;
      }
      else
      {
          [self dListMethod ];
      }
  }
  </code></pre>
  
  <p>In the if() section I want to disable <code>selectedSegmentIndex==0</code> and enable when <code>button.hidden=YES</code></p>