Unable to use iOS framework which is internally using .xib file

前端 未结 8 2269
你的背包
你的背包 2020-12-16 19:14

I am trying to make a universal framework, for iOS by following steps specified in this URL: Universal-framework-iOS

I have a viewController class within, that frame

8条回答
  •  生来不讨喜
    2020-12-16 19:16

    If you're using Universal-framework-iOS all resources (including Nibs and images), will be copied inside a separate bundle (folder) such as MyApp.app/Myframework.bundle/MyNib.nib.

    You need to specify this bundle by passing a NSBundle object instead of nil. Your can get your bundle object as follows:

    NSString *path = [[NSBundle mainBundle] pathForResource:@"Myframework" ofType:@"bundle"];
    NSBundle *resourcesBundle = [NSBundle bundleWithPath:path];
    

    As for images you can just prepend Myframework.bundle/ to their names:

    [UIImage imageNamed:@"Myframework.bundle/MyImage"
    

    This also works in Interface Builder.

    Finally your users to install/update a framework is a pain, specially with resources, so better try to use CocoaPods.

提交回复
热议问题