用 App 委托类中的 Main.storyboard 文件替换 xib 文件 [英] Replace xib file with Main.storyboard file in App delegate class

查看:24
本文介绍了用 App 委托类中的 Main.storyboard 文件替换 xib 文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

现在的项目使用 App 委托类中的 MainWindow.xib 作为主要的 nib 文件.它在 main.m 文件中有此代码

Right now project is using MainWindow.xib in App delegate class as main nib file. It has this code in main.m file

int main(int argc, char *argv[]) {

NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
int retVal = UIApplicationMain(argc, argv, nil, nil);
[pool release];
return retVal;
}

我想用 Mainstoryboard 替换它.我在 info.plist 文件中将它更改为 Mainstoryboard 文件基本名称,但它显示了 没有应用程序委托集的错误.必须指定应用委托类才能使用主情节提要文件.

I want to replace it with Mainstoryboard. I changed it in the info.plist file as Mainstoryboard file base name but it shows error that there is no app delegate set. An app delegate class must be specified to use a main storyboard file.

我应该在 App 委托类中做什么编码才能使用 Mainstoryboard 文件.

What coding i should do in App delegate class to use Mainstoryboard file.

谢谢

推荐答案

UIApplicationMain() 函数的最后一个参数 (nil) 替换为应用程序名称委托类.默认情况下通常是 @"AppDelegate".

Replace the last argument (nil) of the UIApplicationMain() function with the name of the app delegate class. It's generally @"AppDelegate" by default.

这篇关于用 App 委托类中的 Main.storyboard 文件替换 xib 文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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