title: Change the color of selected segment control
body: <p>In my app,i able to change the color of the selected segment control.But the color is changed for another index rather than selected index. I can find any mistake in the index. </p>
  
  <p>Help me!</p>
  
  <p>my code is as follow:</p>
  
  <pre><code>if([SegmentRound selectedSegmentIndex] == 0)
      {
  
          UIColor *newSelectedTintColor2 = [UIColor colorWithRed: 98/255.0 green:156/255.0 blue:247/255.0 alpha:1.0];
          [[[SegmentRound subviews] objectAtIndex:0] setTintColor:newSelectedTintColor2];
  
          UIColor *newSelectedTintColor1 = [UIColor colorWithRed: 54/255.0 green:52/255.0 blue:48/255.0 alpha:1.0];
          [[[SegmentRound subviews] objectAtIndex:1] setTintColor:newSelectedTintColor1];
  
          UIColor *newSelectedTintColor0 = [UIColor colorWithRed: 54/255.0 green:52/255.0 blue:48/255.0 alpha:1.0];
          [[[SegmentRound subviews] objectAtIndex:2] setTintColor:newSelectedTintColor0];
  
  
  
          FLAGROUND=1;
      }
  
      if([SegmentRound selectedSegmentIndex] == 1)
      {
          UIColor *newSelectedTintColor1 = [UIColor colorWithRed: 98/255.0 green:156/255.0 blue:247/255.0 alpha:1.0];
          [[[SegmentRound subviews] objectAtIndex:1] setTintColor:newSelectedTintColor1];
  
          UIColor *newSelectedTintColor0 = [UIColor colorWithRed: 54/255.0 green:52/255.0 blue:48/255.0 alpha:1.0];
          [[[SegmentRound subviews] objectAtIndex:0] setTintColor:newSelectedTintColor0];
  
          UIColor *newSelectedTintColor2 = [UIColor colorWithRed: 54/255.0 green:52/255.0 blue:48/255.0 alpha:1.0];
          [[[SegmentRound subviews] objectAtIndex:2] setTintColor:newSelectedTintColor2];
  
          FLAGROUND=2;
      }
      if([SegmentRound selectedSegmentIndex] == 2)
      {
          UIColor *newSelectedTintColor0 = [UIColor colorWithRed: 98/255.0 green:156/255.0 blue:247/255.0 alpha:1.0];
          [[[SegmentRound subviews] objectAtIndex:2] setTintColor:newSelectedTintColor0];
  
          UIColor *newSelectedTintColor2 = [UIColor colorWithRed: 54/255.0 green:52/255.0 blue:48/255.0 alpha:1.0];
          [[[SegmentRound subviews] objectAtIndex:0] setTintColor:newSelectedTintColor2];
  
          UIColor *newSelectedTintColor1 = [UIColor colorWithRed: 54/255.0 green:52/255.0 blue:48/255.0 alpha:1.0];
          [[[SegmentRound subviews] objectAtIndex:1] setTintColor:newSelectedTintColor1];
          FLAGROUND=3;
      }
  </code></pre>
  
  <p>viewwillAppear:</p>
  
  <pre><code>[SegmentRound setSelectedSegmentIndex:0];
  </code></pre>