Re: C callbacks with NSNotificationCenter?
Re: C callbacks with NSNotificationCenter?
- Subject: Re: C callbacks with NSNotificationCenter?
- From: Jonathan Mitchell <email@hidden>
- Date: Wed, 07 Sep 2016 17:16:12 +0100
> On 7 Sep 2016, at 17:09, Andreas Falkenhahn <email@hidden> wrote:
>
>
> Still, I'm wondering: Is it also possible to have NSNotificationCenter call
> a C function for me whenever the notification triggers? Can this somehow
> be achieved or am I forced to use full Objective C here?
>
I would go about this by creating a singleton Obj-C object to handle all my notifications.
I would then register C Function pointers with this, perhaps using an NSMapTable or its CF equivalent to track the relationship between the incoming notification and the desired c function.
When the notification comes in I look up my map and call the C function.
HTH
J
_______________________________________________
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