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: Uli Kusterer <email@hidden>
- Date: Wed, 29 Aug 2012 17:54:42 +0200
On Aug 25, 2012, at 1:58 AM, Fritz Anderson <email@hidden> wrote:
> 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.
Actually, I think it should work on AppKit as well: The current ABI on MacOS and iOS supports passing more parameters to a function than it actually takes. As long as the caller passes in the "sender" target, the called function can not declare it and be fine, it will just be ignored. (This isn't guaranteed by ANSI, so is not strictly correct code, but it does work on the Mac, iPhone and iPad and is documented to do so).
Cheers,
-- Uli Kusterer
"The Witnesses of TeachText are everywhere..."
http://www.zathras.de
_______________________________________________
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