title: How can I change a UIButton title/color without pressing the button in iOS?
body: <p>The code below does everything I want it to (changing editButton title and color from normal color "Edit" to Red "Cancel" and back when depressed <em>except</em> that when the editButton displays Red "Cancel" and I press the sendButton, I would like the editButton to display normal color "Edit" again.</p>
  
  <p>Am I doing something wrong, or is there something else I need to do?</p>
  
  <p>Thanks, </p>
  
  <p>John</p>
  
  <pre><code>- (IBAction)sendClicked:(id)sender {
      if (dontCheck) {
          dontCheck = NO;
          [editButton setTitle:@"Edit" forState:UIControlStateNormal];
          [editButton setTitleColor:[[sendButton titleLabel] textColor] forState:UIControlStateNormal];  
      }
  // ...     
  }
  
  - (IBAction)editClicked:(id)sender {
      if (dontCheck)  {
          dontCheck = NO;        
          dataLoaded = NO;
          [sender setTitle:@"Edit" forState:UIControlStateNormal];
          [sender setTitleColor:[[submitButton titleLabel] textColor] forState:UIControlStateNormal];
      } else {
          dontCheck = YES;        
          [sender setTitle:@"Cancel" forState:UIControlStateNormal];
          [sender setTitleColor:[UIColor redColor] forState:UIControlStateNormal];
      }
  // ...
  } 
  </code></pre>
  
  <p>This doesn't work for me: (I did make the necessary changes in the xib file.)</p>
  
  <pre><code> - (IBAction)sendClicked:(id)sender { 
      if (dontCheck) {
          dontCheck = NO;
          [editButton setTitle:@"Edit" forState:UIControlStateNormal];
          [editButton setTitleColor:[[submitButton titleLabel] textColor] forState:UIControlStateNormal];
          [editButton setSelected:NO];
      }
    // ... 
  }
  
   - (IBAction)editClicked:(id)sender { 
      if (dontCheck) { 
          dontCheck = NO; 
          dataLoaded = NO;
          [sender setTitle:@"Edit" forState:UIControlStateNormal];
          [sender setTitleColor:[[submitButton titleLabel] textColor] forState:UIControlStateNormal];
          [editButton setSelected:NO`];
      } else {
          dontCheck = YES;
          [sender setTitle:@"Cancel" forState:UIControlStateSelected];
          [sender setTitleColor:[UIColor redColor] forState:UIControlStateSelected];
          [editButton setSelected:YES];
      }
      // ...
  }
  </code></pre>