• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: finding my UIViewController
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

References: 
 >finding my UIViewController (From: Roland King <email@hidden>)
 >Re: finding my UIViewController (From: Roland King <email@hidden>)

  • Prev by Date: Re: finding my UIViewController
  • Next by Date: Re: finding my UIViewController
  • Previous by thread: Re: finding my UIViewController
  • Next by thread: Re: finding my UIViewController
  • Index(es):
    • Date
    • Thread