iOS iPhone 应用程序允许的最大 nib 文件数量
应用程序中可以使用的 nib 文件数量是否有限制。 在我的应用程序中,我使用 50 个 nib 文件,因为我必须在运行时加载此 nib 文件,所以会出现任何内存问题吗?
Is there is any limitation on the number of nib files can be used in a application.
In my application I am using 50 nib files will there be any memory issue as i have to load this nib files on run time.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我不知道是否有限制,但即使你有数百个 NIB,它们也不会同时加载到内存中。 iPhone 应用程序的视图是延迟加载的。这更多的是一个关于应用程序可以有多大的问题。这些文件只是描述你的布局的XML(再次编译为二进制文件)描述你的布局,所以我认为这个数字必须是你要求的很多倍才可能成为问题,甚至那么这是一个关于应用程序可以有多大的问题,而不是 RAM 的问题。
已更新
https://itunesconnect.apple.com/docs/ iTunesConnect_DeveloperGuide.pdf
I don't know if there is a limit, but even though you have hundreds of NIB's they won't be loaded into the memory at the same time. The view's of a iPhone application is lazely loaded. This is more a question on how a large an application can be. Those files are only XML (which again is compiled to binary as commented) files describing your layout so I would suppose that the number must be many times what you asked of before it can be an issue, and even then this is a question on how large an application can be and not RAM.
Updated
https://itunesconnect.apple.com/docs/iTunesConnect_DeveloperGuide.pdf
.xib 文件(在 Xcode 中)和应用程序中的 .nib 文件之间存在差异。 .xib 文件是 xml,.nib 文件是二进制存档。
大小也截然不同,在应用程序中,我的 .xib 文件为 45,124 字节,但应用程序中的 .nib 文件为 4,823 字节。
另外,更多的 nib 文件也可以是好的设计,每个 nib 都包含一个 UI 概念。
There is a difference between .xib files (in Xcode) and .nib files in the app. .xib files are xml and .nib files are binary archives.
The sizes are also drastically different, in an app I have a .xib file was 45,124 bytes but the .nib file in the app was 4,823 bytes.
ALso more nib files can be good design, each nib containing one UI concept.
我对此不确定,但我认为从 nib 文件加载对象实例会产生一点 RAM 开销。然而,当加载对象时,它们可能消耗与“常规”实例相同数量的 RAM。
所以我认为这取决于这些 nib 文件的复杂性。
话又说回来,我不确定,所以不要相信我的话;)。
I'm not sure about this, but I think loading object instances from nib files has a little RAM overhead. When the objects are loaded however, they probably consume the same amount of RAM as 'regular' instances.
So I think it comes down to the complexity of these nib files.
Then again, I'm not sure so don't take my word for it ;).