• 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: how do you suppose targetViewControllerForAction:sender: works?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: how do you suppose targetViewControllerForAction:sender: works?


  • Subject: Re: how do you suppose targetViewControllerForAction:sender: works?
  • From: glenn andreas <email@hidden>
  • Date: Thu, 09 Oct 2014 12:03:15 -0500

(typed in mail)

if ([[vc class] instanceMethodForSelector: selector] != [[vc superclass] instanceMethodForSelector: selector]) {
	// vc's class implements an instance method that is different from it's superclass - i.e., it has overridden it
}

On Oct 9, 2014, at 11:56 AM, Matt Neuburg <email@hidden> wrote:

> From the WWDC 2014 video 216: "targetViewControllerForAction works by looking at the View Controller and seeing if it's _overwritten_ the action method that you've passed in."
>
> From Kyle Sluder's blog: "-targetViewControllerForAction:sender: ... will then determine whether the instance’s method for that selector is an override of a UIViewController implementation for the same selector."
>
> Those descriptions are correct. But then how do you suppose it does this? There's an introspective voodoo happening here that I've never seen before. `respondsToSelector:` obviously doesn't cut it: it would return YES if this class merely _inherits_ the ability to respond to this selector. How would you find out the answer to the question, "does this UIViewController subclass respond to this selector _differently_ from UIViewController?"
>
> Thx - m.
>
> --
> matt neuburg, phd = http://www.apeth.net/matt/
> pantes anthropoi tou eidenai oregontai phusei
> Programming iOS 7! http://shop.oreilly.com/product/0636920031017.do
> iOS 7 Fundamentals! http://shop.oreilly.com/product/0636920032465.do
> RubyFrontier! http://www.apeth.com/RubyFrontierDocs/default.html
>
>
>
> _______________________________________________
>
> Cocoa-dev mailing list (email@hidden)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden



Glenn Andreas                      email@hidden
The most merciful thing in the world ... is the inability of the human mind to correlate all its contents - HPL


_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden


  • Follow-Ups:
    • Re: how do you suppose targetViewControllerForAction:sender: works?
      • From: Matt Neuburg <email@hidden>
References: 
 >how do you suppose targetViewControllerForAction:sender: works? (From: Matt Neuburg <email@hidden>)

  • Prev by Date: Re: Open document panel always on top - Mountain Lion
  • Next by Date: Re: how do you suppose targetViewControllerForAction:sender: works?
  • Previous by thread: how do you suppose targetViewControllerForAction:sender: works?
  • Next by thread: Re: how do you suppose targetViewControllerForAction:sender: works?
  • Index(es):
    • Date
    • Thread