How to call a selector in another class

How would this code differ if the method was in a different class?

[saveButton addTarget:self action:@selector(saveArray) forControlEvents:UIControlEventTouchUpInside];
+5
source share
2 answers

Pass the object (which responds to the method) as the target parameter.

[saveButton addTarget: targetObj action: @selector (saveArray) forControlEvents: UIControlEventTouchUpInside];
+12
source

You need to replace with an selfinstance of another class.

+5
source

All Articles