views:

18

answers:

1

Hi all,

I want to develop an iphone app which communicate with the hardware by using tcp/ip. Now, the app send to the hardware is ok. For the convenience to develop, i want to use fire event to develop the receiver. Does anyone has any ideas?

Joe

+2  A: 

To raise an event:

[[NSNotificationCenter defaultCenter] postNotificationName:notificationName object:someObj];

To listen for the event:

[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(notificationSelector:) name:notificationName object:notificationSender];

To stop listening for the event:

[[NSNotificationCenter defaultCenter] removeObserver:self name:notificationName object:notificationSender];

More here

slf