iOS - loading xib from bundle in Documents directory

后端 未结 4 527
故里飘歌
故里飘歌 2021-02-06 05:38

I\'ve been working on getting \"custom skinnable\" interfaces working for my iOS app by bundling up xibs and downloading bundles, and loading the xibs in those bundles.

4条回答
  •  谎友^
    谎友^ (楼主)
    2021-02-06 05:50

    Excerpt from the Resource Programming Guide:

    In UIKit, applications can load nib files only from their main bundle..

    Doesn't sound like you can do what you're wanting to do. Or at least, Apple doesn't want you to do it. You can, of course, always download a .bundle with images and load them as UIImage or similar, and then save the "active" skin into a known directory which is the directory your app always looks for the images to use when displaying the interface. Changing the skin equates to replacing the image resources at that path with ones from a downloaded bundle.

提交回复
热议问题