制作framework用bundle存放资源文件
1、制作iOS Bundle
![](https://img.haomeiwen.com/i1621540/e60688f8f457e854.png)
2、修改Base SDK为iOS,因为是framework是提供给iOS用的
![](https://img.haomeiwen.com/i1621540/bf78a393d7005f8f.png)
3、设置Build Setting中的COMBINE_HIDPI_IMAGES为NO,否则Bundle中的图片就是tiff格式了
![](https://img.haomeiwen.com/i1621540/1b637dddf9266771.png)
4、作为资源包,仅仅需要编译即可,无需安装任何配置,设置Skip Install为Yes,同样删除安装路径Installation Diretory的值
![](https://img.haomeiwen.com/i1621540/87aef51494ddfe7c.png)
5、最后把想要放入Bundle中的资源文件导入
![](https://img.haomeiwen.com/i1621540/b94e6817f8d17684.png)
使用
编译生成 Bundle 文件。---分别选择 Generic iOS Device 和任意一个模拟器各编译一次,编译完后,我们会看到工程中 Products 文件夹下的 SourcesBundle.bundle 由红色变成了黑色。
show in finder,看看生成的文件。我们看到它为真机和模拟器都生成了 .bundle 资源文件。
framework中使用
1、直接导入framework中
![](https://img.haomeiwen.com/i1621540/2e9a157776eb6a4f.png)
2、在framework中的使用图片
![](https://img.haomeiwen.com/i1621540/a5edaad4c7e1f9c2.png)
3、打包后的framework里面已经有了resource.bundle
![](https://img.haomeiwen.com/i1621540/85557d5ba98a707c.png)
网友评论