title: Comparing two UIColors is not working in the first time
body: <p>When i click on OK button of an UIAlertView, i need to change the background color of the view, its default color is the white, so every time the user click on OK, i need to alternate between two colors, white and red for example:</p>
  
  <pre><code>-(void)changeColor{
  
          if([self.view.backgroundColor isEqual: [UIColor whiteColor]]){
  
              self.view.backgroundColor=[UIColor redColor];
          }else {
              self.view.backgroundColor=[UIColor whiteColor];
          }
  }
  </code></pre>
  
  <p>The problem is that on first OK click, the color is supposed to become red, however it doesn't get the red, so i need to click the OK button the second time to get the view background color with the red. am i missing something to get the color changed from the first time?</p>
  
  <p>This is the <code>alertView:didDismissWithButtonIndex</code> delegate method:</p>
  
  <pre><code>- (void)alertView:(UIAlertView *)alertView didDismissWithButtonIndex:(NSInteger)buttonIndex{
  
  
      if (buttonIndex==0) {
          //NSLog(@"It's Ok button which has been clicked");
          //Do whatever you want, commonly call to another function like so:
          [self changeColor];
      }else
          if (buttonIndex==1) {
              //NSLog(@"It's Cancel button which has been clicked");
          }
  
  }
  </code></pre>