Re: Have to specify (id)sender to action methods in OS X but not in iOS?
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