Usually I'm assigning single selector to multiple UIButton
s in this way only,
[buttonOne addTarget:self action:@selector(someAction:) forControlEvents:UIControlEventTouchUpInside];
[buttonTwo addTarget:self action:@selector(someAction:) forControlEvents:UIControlEventTouchUpInside];
[buttonThree addTarget:self action:@selector(someAction:) forControlEvents:UIControlEventTouchUpInside];
Today I found another way,
SEL selector = NSSelectorFromString(@"someAction:");
[buttonOne addTarget:self action:selector forControlEvents:UIControlEventTouchUpInside];
[buttonTwo addTarget:self action:selector forControlEvents:UIControlEventTouchUpInside];
[buttonThree addTarget:self action:selector forControlEvents:UIControlEventTouchUpInside];
Please note that, I'm assigning this selector in table to each rows with above buttons.
Which way is more efficient? I assuming second way because we're creating selector for once, but not sure.