title: iOS: change background color using multiple buttons
body: <p>I am trying to change background color randomly as an effect overtime any of the buttons on the screen are tapped.
  I would like to control this effect with an On/Off UIButton.
  Tapping ChangeColorButton just logs “Off” never “On”. Not sure what to do? thanks everyone!!</p>
  
  <p>edited code so far!!
  in .h </p>
  
  <pre><code>@property(nonatomic,readwrite) BOOL shouldChangeColor;
  
  in .m
  - (IBAction)ChangeColorButton:(UIButton*)sender {
  
     // self.shouldChangeColor = !sender.selected;
     sender.selected = !sender.selected;
      if(sender.selected)
      {
          NSLog(@"Switch is ON");
          //Make it off now
        //  sender.selected=NO;
     //    self.shouldChangeColor=TRUE;
  
  
  
      }
      else
  
          NSLog(@"Switch is OFF");
      //Make it on now
     // sender.selected=YES;
      self.shouldChangeColor=TRUE;
  
          }
  
  - (void)randomColor{
      int r = arc4random() % 255;
      int g = arc4random() % 255;
      int b = arc4random() % 255;
  
      UIColor *color = [UIColor colorWithRed:(r/255.0) green:(g/255.0) blue:(b/255.0) alpha:1.0];
  
      [self.view setBackgroundColor:color];
  
  }
  </code></pre>