I’ve got a parentViewController with a navigation controller.
I push a view on the navigation controller. Now I can easily set its delegate to self (to make it point to my parentViewController), however from the child view I will push the next and the next view onto the navigationcontroller. Now I want the last view also to have its delegate point to the parent view.
e.g.
parentWindowController (navigationController)
- firstViewController –> secondViewController –> thirdViewController
Is it possible to set the delegate of the thirdViewController to the parentWindowController from within its initialization?
The third view is created in the second view therefore I couldn’t set this in the beginning.
I wonder how I can reference the parentWindow.
It might be the wrong approach, please let me know if it can be done easier/better?
I solved the problem by assigning the delegate for firstViewController within the parentViewController.
Now when I create the second view controller I pass this delegate on. When I create the third view controller I can set the delegate to the initially passed through delegate. This works.
I am still curious however if it was possible to do this directly from within the ThirdViewController without passing it through.