正确使用UIApplicationMain [英] Proper use of UIApplicationMain
问题描述
我决定以编程方式加载我的视图,所以放:
I have decided to load my views programmatically, so putting:
int ret = UIApplicationMain(argc, argv, nil, nil);
无效。不过,我确实有一个ViewController和一个AppDelegate。什么是UIApplicationMain正确使用ViewController和AppDelegate。
PS我不使用XCode或Interface Builder,我正在开发工具链。
Would not work. I do have a ViewController and an AppDelegate, though. What would be the proper use of UIApplicationMain to use a ViewController and an AppDelegate.
PS I am NOT using XCode or Interface Builder, I am developing on the toolchain.
推荐答案
int UIApplicationMain (
int argc,
char *argv[],
NSString *principalClassName,
NSString *delegateClassName
);
由于你没有UIApplication的子类,传递 nil
到第3个论点。但是你有一个自定义的UIApplicationDelegate。所以将它的类名传递给第四个参数。
Since you did not subclass UIApplication, pass nil
to the 3rd argument. But you have a custom UIApplicationDelegate. So pass its class name to the 4th argument.
int retval = UIApplicationMain(argc, argv, nil, @"AppDelegate");
这篇关于正确使用UIApplicationMain的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!