I have 4 classes (views):
A, B, C and D
Class A calls B, B calls C, and C Calls D:
A > B > C > D
In class D I have implemented a delegate protocol and I want to catch the delegate event in class A.
How can I achieve this?
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.
There are multiple ways how you could achieve this. What’s best in your case depends on the situation. Here are some ideas:
NSNotifications(not to be confused withNSUserNotificationsin Mountain Lion). In your class A you post a notification to the default notification center and in class D you register to this notification and handle it as you want. Only use this approach though if nothing else works, because this can result in even worse code.