如何在 Objective-c 中像 QT 一样使用信号和槽发送和接收信号?
How to emit and receive signals in Objective-c like QT with signals and slots?
在 QT 中,您可以发出信号并使用槽对其进行操作。否则我已经写了很多线程来等待通过全局变量执行的信号。 QT的signals和slots好像效率高多了。
如何在 Objective-c 中像带有信号和槽的 QT 一样发射和接收信号?谢谢
这可以通过 NSNotificationCenter to broadcast NSNotification objects to other objects. For a simple example see this post 完成。
在 QT 中,您可以发出信号并使用槽对其进行操作。否则我已经写了很多线程来等待通过全局变量执行的信号。 QT的signals和slots好像效率高多了。
如何在 Objective-c 中像带有信号和槽的 QT 一样发射和接收信号?谢谢
这可以通过 NSNotificationCenter to broadcast NSNotification objects to other objects. For a simple example see this post 完成。