I am attempting to call presentModalViewController on a UIViewController in order to bring up a Address Book "view", however I am running into a bit of a problem. The UIViewController that "controls" the app simply draws a view to the screen and then lets the view do all of the handling of user interaction, etc. But now, I need to somehow need to back track to the UIViewController in order to call presentModalViewController on it. Would anyone have any ideas of how to accomplish this?
Thanks for any help!
I would suggest giving your custom view class some kind of delegate that will allow it to ask the delegate for some address book info. The delegate in this case would be the view controller which would respond by showing the picker and then returning the result of that.
Your UIView should emit an event (by using the pattern used in UIButtons, etc) to a delegate (either conforming to a protocol, or using a specific selector).
If this isn't possible, view.nextResponder should be your UIViewController, if the view was created by the UIViewController.
Assuming your controller's UIView is subclassed, you could add a property to it.
Then in your UIViewController code assign self to the
parentController
property.Is this what you were after? Begs the question though, why isn't your view controller not controlling your view?