Search code examples
iosloadingnsbundle

loading NSBundle files on iOS


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)

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?


Solution

  • untested.

    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];