iphone - NSBundle 的主要类

标签 iphone nsbundle

请帮助我理解principalClass的用途是什么?它的语法是什么。我知道它是在 NSBundle 类中,但是我们可以为任何 bundle 创建它吗?它是否只针对 laodable bundle ?请帮助我了解principalClass的概念。

谢谢你。

最佳答案

bundle 的“主类”仅仅是被标记为bundle 的主类的 Objective-C 类,因此将由bundle 实例的 -principalClass 方法返回。

不多不少,没有什么魔力。

它只存在于可加载包中,因为只有可加载包定义新的 Objective-C 类。

关于iphone - NSBundle 的主要类,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1967891/

相关文章:

iphone - 如何从 iOS 上的主机名解析 IP 地址

iphone - 自定义单元的重复使用

ios - 如果今天是本月的最后一天,如何添加日期。?

ios - 'NSBundle mainBundle' pathForResource 奇怪的行为

objective-c - 在包 NSBundle 中找不到名为 'Main' 的 Storyboard

iphone - 在 iPad 上展示 iAd 和 AdMobAd

iphone - 嵌入 Segue 不向后兼容

ios - 当从 Interface Builder 设置 UIImageView 的图像时,该图像是如何加载的?

objective-c - 使用 [NSBundle loadNibNamed :owner:] but the window does not appear in the foreground 加载 NIB

ios - Bundle.preferredLocalizations 困惑