Re: finding my UIViewController
Re: finding my UIViewController
- Subject: Re: finding my UIViewController
- From: Hamish Allan <email@hidden>
- Date: Thu, 04 Aug 2011 12:24:46 +0100
On 4 August 2011 11:58, Roland King <email@hidden> wrote:
> When you hit the button and want to bring up the image picker you need to do it by calling presentModalViewController:animated: on some UIViewController. The question was how do you find a UIViewController to call it on? UIViews have no link back to any UIViewController. You could of course make all your custom views have such a link and hook it up every time you added them to a superview, but it would be a real pain and not very generic.
This is precisely what the responder chain is for. See the
documentation for -[UIControl addTarget:action:forControlEvents:]
Parameters: target: The target object—that is, the object to which the
action message is sent. If this is nil, the responder chain is
searched for an object willing to respond to the action message.
Just implement a suitably uniquely-named action method in your view
controller, give the button a nil target, and Bob's your uncle.
H
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden