title: How do you use event handlers with parameters?
body: <p>I'm trying to sort out how the events work. In video 4 of the Stanford course on iTunes U, Alan Cannistraro says there are</p>
  
  <p>"3 different flavors of action method selector types
  - (void)actionMethod;
  - (void)actionMethod:(id)sender;
  - (void)actionMethod:(id)sender withEvent:(UIEvent *)event;"</p>
  
  <p>I thought I'd try them out with a simple adding program - you enter 2 numbers and as you type the sum gets places in a 3rd UITextField. I have a method with the no-parameter signature, and it works fine. When I change it to the second with the sender parameter, the code stops calling the method.</p>
  
  <p>This works:</p>
  
  <pre><code>-(void) setSum {
  float a1 = addend1.text.floatValue;
  float a2 = addend2.text.floatValue;
  float thesum = a1 + a2;
  NSString * ssum = [NSString stringWithFormat:@"%g", thesum]; 
  sum.text = ssum;
  }
  
  -(void)awakeFromNib {
  SEL setSumMethod = @selector(setSum);
  [addend1 addTarget: self action: setSumMethod forControlEvents: UIControlEventEditingChanged];
  [addend2 addTarget: self action: setSumMethod forControlEvents: UIControlEventEditingChanged];
  }// awakeFromNib
  </code></pre>
  
  <p>This runs but setSum doesn't get called:</p>
  
  <pre><code>-(void) setSum:(id) sender {
  float a1 = addend1.text.floatValue;
  float a2 = addend2.text.floatValue;
  float thesum = a1 + a2;
  NSString * ssum = [NSString stringWithFormat:@"%g", thesum]; 
  sum.text = ssum;
  }
  
  
  -(void)awakeFromNib {
  SEL setSumMethod = @selector(setSum:);
  [addend1 addTarget: self action: setSumMethod forControlEvents: UIControlEventEditingChanged];
  [addend2 addTarget: self action: setSumMethod forControlEvents: UIControlEventEditingChanged];
  }// awakeFromNib
  </code></pre>
  
  <p>So, the question is when do the other event method types work? Only the first seems to apply.</p>
  
  <p>TIA</p>
  
  <p>Mark</p>