iPhone中[NSBundle mainBundle]的含义是什么? [英] What the meaning of [NSBundle mainBundle] in iPhone?

查看:63
本文介绍了iPhone中[NSBundle mainBundle]的含义是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

RootViewController *rvController = [[RootViewController alloc] initWithNibName:@"RootViewController" bundle:[NSBundle mainBundle]];

有时我看到它使用nil,我不知道它的确切用途?

sometimes i see it use nil ,i dont know what exactly it use for?

推荐答案

以下是确切的解释:


在其中搜索
nib文件的捆绑软件。该方法首先在捆绑软件的
语言项目目录
中查找
nib文件,然后在Resources
目录中查找。如果为nil,则此方法在主包中的$ nib文件中查找

The bundle in which to search for the nib file. This method looks for the nib file in the bundle's language-specific project directories first, followed by the Resources directory. If nil, this method looks for the nib file in the main bundle.

我认为[NSBundle mainBundle]不会做与您不加零不同的事情。但是,如果要进行国际化和本地化,则可以使用它们

I think [NSBundle mainBundle] doesn't do anything different than you put nil. However, if you want to do internationalization and localization, you can use them

此处有更多详细信息

这篇关于iPhone中[NSBundle mainBundle]的含义是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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