I have to pass an object to an button’s action… something like
[myButton addTarget:self action:@selector(sendIt:MY_OBJECT) forControlEvents:UIControlEventTouchDown];
I cannot set a variable and use that on the method because I am on a static class.
How do I do that?
I discovered a way to do that.
You create a class of UIButton and inside the class you declare a public variable that corresponds to the type of object you want to pass.
When you create the button you use that class and store the object inside its property.
then when the button is clicked you retrieve the ID, retrieve the button and the object stored inside it.
Now you have the object…