How can I make a UIButton perform my class method, +doSomething:(id)sender, on class MyClass, after any event like UIControlEventTouchDown? Can I use -addTarget:action:forControlEvents: like I do for instance methods?
Thanks in advance.
Since classes are also ObjC objects, you can use -addTarget:... as usual:
[button addTarget:[MyClass class]
action:@selector(classMethod:)
forControlEvents:UIControlEventTouchUpInside];
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With