如何使用Xcode触发事件?

0 iphone events xcode

我想开发一个使用tcp/ip与硬件通信的iphone应用程序.现在,应用程序发送到硬件是好的.为了方便开发,我想用fire事件来开发接收器.有没有人有任何想法?

slf*_*slf 6

举办活动:

[[NSNotificationCenter defaultCenter] postNotificationName:notificationName object:someObj];
Run Code Online (Sandbox Code Playgroud)

听取这个事件:

[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(notificationSelector:) name:notificationName object:notificationSender];
Run Code Online (Sandbox Code Playgroud)

要停止收听事件:

[[NSNotificationCenter defaultCenter] removeObserver:self name:notificationName object:notificationSender];
Run Code Online (Sandbox Code Playgroud)

更多这里