I have a programmatically created UIButton with a UIScrollView. When this button is pressed, it triggers an action, but besides just triggering the action, I want the button to send a (int) variable to the method as well.
Here is my button:
UIButton *btn15 = [UIButton buttonWithType:UIButtonTypeRoundedRect];
[btn15 setTitle:@"Cool title" forState:UIControlStateNormal];
[btn15 setFrame:CGRectMake(165, 770, 145, 145)];
[btn15 addTarget:self action:@selector(selectFav) forControlEvents:UIControlEventTouchUpInside];
[_scroller addSubview:btn15];
...So this is my 15th button within this scroll view. I want to write the method 'selectFav' to handle a button press. I would like each button to send to the method it's number, and then have the method print the number out to NSLog. Since this example is button 15, I want to have the the number 15 somehow passed to selectFav.
I'm assuming this is an easy thing to do, but can't seem to make it work. Thanks for any suggestions!