美文网首页
iOS制作.a静态库中添加bundle

iOS制作.a静态库中添加bundle

作者: 哭与行 | 来源:发表于2021-05-13 17:01 被阅读0次

1.添加bundle

添加bundle

2.修改

3.设置依赖

4.添加图片到bundle

5.设置bunle宏定义

#define HISUNPLUGIN_BUNDLE_NAME @"HisunSilentlivenessPluginBundle.bundle"

#define HISUNPLUGIN_BUNDLE_PATH [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent: HISUNPLUGIN_BUNDLE_NAME]

#define HISUNPLUGIN_MYBUNDLE [NSBundle bundleWithPath: HISUNPLUGIN_BUNDLE_PATH]

6.使用

 self.imgview.image = [UIImage imageWithContentsOfFile:[HISUNPLUGIN_MYBUNDLE pathForResource:@"111" ofType:@"png"]];

7.使用bunle添加xib文件

8.xib控制器使用

HisunIdentityAuthenticationViewController *mainVC = [[HisunIdentityAuthenticationViewController alloc] initWithNibName:@"HisunIdentityAuthenticationViewController" bundle:HISUNPLUGIN_MYBUNDLE];

补充: 可能使用如上方法不能成功加载图片,可以更换图片试试,可能本身图片问题导致.

相关文章

网友评论

      本文标题:iOS制作.a静态库中添加bundle

      本文链接:https://www.haomeiwen.com/subject/gvrxjltx.html