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

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

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

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容