cocospod本地库(三)——含.framework
2019-01-29 本文已影响3人
SunshineFlow
版本记录
版本号 | 时间 |
---|---|
v1.0 | 2019.01.29 星期二 |
前言
上一篇文章讲解了如何创建一个framework文件,使用了直接集成到工程中的方法。这一篇介绍如何使用cocospod的方式导入framework。
使用方法
配置.framework中路径的配置
imageView.image = [UIImage imageNamed:@"source.bundle/bd_logo"];
(因为在下面.podspec中配置source最后会生成source.bundle)
配置.podspec文件
s.vendored_frameworks = "camera/Classes/testFramework.framework"(.framework文件配置)
s.resource_bundles = {
'source' => ['camera/Assets/*.{nib,png}']
}(资源文件配置)
.framework路径
资源文件路径
运行后生成source.bundle
需要使用source.bundle的时候
NSBundle *source = [NSBundle bundleWithPath:[[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:@"source.bundle"]];
TestViewController * test = [[TestViewController alloc]initWithNibName:@"TestViewController" bundle:source];