My friend Josh Sklar (a senior at Michigan, and soon to be full time iOS dev at Detroit Labs) wrote a very cool subclass of UIButton that allows you to pass a block to a button and have it executed with a given UIControlEvent.
For example, instead of creating a ton of selectors, you can now simply do:
JSButton *buttonOne = [[JSButton alloc]initWithFrame:CGRectMake((self.view.frame.size.width - kButtonWidth)/2, kLabelHeight, kButtonWidth, kButtonHeight)]; [buttonOne setTitle:@"Buton One" forState:UIControlStateNormal]; [buttonOne performBlock:^(id sender) { JSButton *btn = (JSButton*)sender; NSLog(@"Some trivial code for touching up inside on %@", btn.titleLabel.text); } forEvents:UIControlEventTouchUpInside]; [self.view addSubview:buttonOne];
Here is a link to the repo: https://bitbucket.org/jrmsklar/jsbutton