• 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: Have to specify (id)sender to action methods in OS X but not in iOS?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Have to specify (id)sender to action methods in OS X but not in iOS?


  • Subject: Re: Have to specify (id)sender to action methods in OS X but not in iOS?
  • From: Fritz Anderson <email@hidden>
  • Date: Fri, 24 Aug 2012 18:58:32 -0500

Assuming the "it" you are getting away with is not needing to accept a parameter…

On 24 Aug 2012, at 5:46 PM, Laurent Daudelin <email@hidden> wrote:

> Anybody can explain why I need to add the (id)sender to any action (IBAction) methods I declare in a Mac OS X project as opposed to being able to get away with it in the same file in an iOS project???

You need to do it under AppKit, and not under UIKit, because they are two different frameworks, designed nearly twenty years apart.

AppKit action methods have taken sender parameters since (I assume) the framework was first designed in the '80s. Apple probably doesn't want to monkey with that code.

UIKit was a fresh start in the past five-plus years. With a generation of experience, Apple apparently didn't think it was always useful to pass sender pointers. You can get away with declaring action methods without parameters (or with two) because UIKit supports it, as AppKit does not.

	— F

--
Fritz Anderson -- Xcode 4 Unleashed: Now in stores! -- <http://x4u.manoverboard.org/>


_______________________________________________

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: Have to specify (id)sender to action methods in OS X but not in iOS?
      • From: Uli Kusterer <email@hidden>
References: 
 >Have to specify (id)sender to action methods in OS X but not in iOS? (From: Laurent Daudelin <email@hidden>)

  • Prev by Date: Re: Finder Info
  • Next by Date: Trying to understand/prevent crash using restorableStateKeyPaths in NSPersistentUI Work
  • Previous by thread: Have to specify (id)sender to action methods in OS X but not in iOS?
  • Next by thread: Re: Have to specify (id)sender to action methods in OS X but not in iOS?
  • Index(es):
    • Date
    • Thread