How can I call an Objective-C method from another class?
For instance in xCode I have two scripts: the delegate and another one. How might I call someFunction on script2 from the delegate?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
If by “script” you mean class, you would need to link both classes.
if objectA is delegate of objectB, when objectB call a method from the delegate protocol:
On the implementation of ClassA:
If you get an error/warning (like warning: no ‘-methodToBeCalled’ method found) when building on the line:
It means that you have to import ClassB to into your ClassA, by doing: