Skip to content

Instantly share code, notes, and snippets.

@sebastienwindal
Created November 21, 2012 15:34
Show Gist options
  • Save sebastienwindal/4125476 to your computer and use it in GitHub Desktop.
Save sebastienwindal/4125476 to your computer and use it in GitHub Desktop.
bad practire
- (IBAction)myButtonAction:(id)sender {
UIButton *myButton = (UIButton *) sender;
if (myButton.tag == 1) {
// do X
}
else if (myButton.tag == 2) {
// do Y
}
else if (myButton.tag == 3) {
// do Z
}
//etc...
}
- (IBAction)myButtonAction:(id)sender {
if (sender == self.saveButton) {
// do X
}
else if (myButton == self.cancelButton) {
// do Y
}
else if (myButton == self.helpButton) {
// do Z
}
//etc...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment