iOS:包含图片资源的静态库打包
2017-10-25 本文已影响8人
静谧的橘子
首先,我们需要创建一个bundle,bundle用于保存图片资源、xib等;


把需要的图片添加进工程,然后将Base SDK选为支持iOS的,然后command + B进行编译,编译成功后,bundle基本可用,通过show in finder就可以找到bundle的位置。
接着,创建静态库工程;

将之前产生的bundle,添加到工程中,通过1、2、3的步骤,然后点击第4步的New Headers Phase

点击过后,如下图所示,

然后将头文件添加进去

然后手动拖入public项中

然后在类中编辑代码

编辑完成,进行编译,编译成功以后,基本就可以完成,然后通过show in finder,获取静态库跟头文件,导入需要的工程即可。
