在Cocoa命令行程序中运行NSRunLoop
问题描述:
可以在不加载任何NIB文件的情况下初始化 NSRunLoop
(即,不调用 NSApplicationMain()
) ?
Is it possible to initialize a NSRunLoop
without loading any NIB files (i.e., without calling NSApplicationMain()
)?
谢谢。
答
您可以编写自己的main方法并运行 NSRunLoop
,而不从 NSApplicationMain
返回。
Yes; you can write your own main method and run NSRunLoop
without returning from NSApplicationMain
.
请查看此链接;这个家伙在他的主要方法使用NSRunLoop,他不加载NIB文件,但它应该让你去与 NSRunloops
。
Have a look at this link; this guy is using NSRunLoop in his main method, he is not loading NIB files though, but it should get you going with NSRunloops
.