I have 3 viewController classes, A, B and C.
From class A, I push and present class B and then from class B I push and present class C. All classes have delegate protocols defined, so
- b.delegate = a
- c.delegate = b
Now I am inside class C, but I need to run a method from class A.
What is the best way to call that method? I mean the best practice.
I can imagine declaring this on B
- (BOOL) myMethodOnA {
// this method on B will run the method on A and return it to C
return [delegate myMethodOnA];
}
but this sounds to me like a bad solution.
Any suggestions?
thanks.
I might miss something obvious but shouldn’t this work?
[c.delegate.delegate myMethodOnA]
Also get into the habit of using accessors (make sure you don’t take ownership of delegates). ARC makes this so much better.