制作framework用bundle存放资源文件
2018-09-25 本文已影响13人
joeal
制作framework用bundle存放资源文件
1、制作iOS Bundle

2、修改Base SDK为iOS,因为是framework是提供给iOS用的

3、设置Build Setting中的COMBINE_HIDPI_IMAGES为NO,否则Bundle中的图片就是tiff格式了

4、作为资源包,仅仅需要编译即可,无需安装任何配置,设置Skip Install为Yes,同样删除安装路径Installation Diretory的值

5、最后把想要放入Bundle中的资源文件导入

使用
编译生成 Bundle 文件。---分别选择 Generic iOS Device 和任意一个模拟器各编译一次,编译完后,我们会看到工程中 Products 文件夹下的 SourcesBundle.bundle 由红色变成了黑色。
show in finder,看看生成的文件。我们看到它为真机和模拟器都生成了 .bundle 资源文件。
framework中使用
1、直接导入framework中

2、在framework中的使用图片

3、打包后的framework里面已经有了resource.bundle
