正确使用UIApplicationMain [英] Proper use of UIApplicationMain

查看:129
本文介绍了正确使用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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆