I have a method that is being called when a UIButton is clicked. When I create the button I want it to store an NSTimer as an argument.
This is the timer and the cr
You could take the approach where you extend UIButton.
@interface MyButton : UIButton
@property (nonatomic, retain) NSDictionary *userInfo;
@end
Then your method
- (void)foo:(MyButton *)sender{
NSLog(@"%@", [sender.userInfo valueForKeyPath:@"extraData"]);
}
And to set userInfo
...
MyButton *myButton = (MyButton *)[UIButton buttonWithType:UIButtonTypeCustom];
//set up a dictionary with info, called userInfo
myButton.userInfo = userInfo;
[myButton addTarget:self selector:@selector(foo:) forControlEvent:UIControlEventTouchUpInside];
Would that work for you?