本文介绍了在iOS上加载NSBundle文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想创建一个具有非常灵活的图形用户界面( skinnable )的项目。为了实现这一点,我想从外部资源加载NSBundle,例如一个网站。捆绑包应该包含与主项目中的一些属性和方法相对应的笔尖(IBOutlets& IBActions)

I'd like to create a project that has a very flexible graphical user interface (skinnable). In order to make this possible, I'd like to load a NSBundle from an external resource, e.g. a website. The bundle should contain nibs that correspond to some properties and methods in the main project (IBOutlets & IBActions)

似乎Apple限制了在这样的情况下使用NSBundle的可能性办法。我有什么方法可以做这个工作吗?如果以传统的方式不可能,那么推荐的替代方法是什么?

It seems Apple has limited the possibility to use NSBundle in such a way. Is there any way I can make this work? If it's not possible in the conventional way, what would be a recommendable alternate approach?

推荐答案

未经测试。

您可以使用解压缩zip文件中的所有内容。

You can distribute all the content in a zip file, unzip using SSZipArchive.

NSBundle* bundle = [NSBundle bundleWithPath:absolutePathToNibFile].

UIViewController* vc = [[[MyViewController alloc] initWithNibName:@"mycustomnib" bundle:bundle] autorelease];

这篇关于在iOS上加载NSBundle文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-22 18:31