what I want to do is I created my own button class but I need to provide the ability for the developer to have their own button callback.
For example, I can declare a new button in this way:
Button* myButton = [[Button alloc] init];
// What I want is something like this
[myButton setSelector: @selector(callMe)];
// and I have this method implemented
- (void)callMe
{
NSLog("I'm being called");
}
Inside my button class I need to have one variable to store what function it will be calling. For example, in my Button class:
if (onButtonClick)
[self callSelector];
How can I do that?
EDIT: I've found a solution here: How to perform Callbacks in Objective-C