封装.a 静态库 封装.a 静态库 剩下的操作和动态更新差不多!

创建bundle 只需要将图片资源放入一个文件夹如:imageSource 然后把后缀改成.bundle即可

使用资源图片

$ NSBundle *imageSourceBundle = [NSBundle bundleWithPath:[[NSBundle mainBundle] pathForResource:@"imageSource" ofType:@"bundle"]]

拼接路径

 $ if (retainFllow5) {// 判断加载几倍图
    imageSuffix = [NSString stringWithFormat:@"%[email protected]",n];
    } else {
       imageSuffix = [NSString stringWithFormat:@"%[email protected]",n];
    }
$ NSString *mosaic = [NSString stringWithFormat:@"%@%@", imagePrefix, imageSuffix];
$ NSString *imageSource = [imageSourceBundle pathForResource:mosaic ofType:@"png"];

这里得到的就是你需要的图片资源

$ [UIImage imageWithContentsOfFile:imageSource]

将需要的头文件添加到publicGroup 内 封装.a 静态库 分别声称release 和debug 两个版本的.a 文件方便调试和 真机使用 将两个版本.a 合并 封装.a 静态库

$ lipo -create /Users/chenwei/Desktop/XXX/debug/libPeopleKeybord.a /Users/chenwei/Desktop/XXX/release/libPeopleKeybord.a -output /Users/chenwei/Desktop/XXX/libPeopleKeybord.a

看下 你会发现1 就是lipo -create ……后的Path 2 就是1.a 空之后的Path 3 就是 -output 之后的Path 也就是 你需的合并后的.a 库

将.a 和bundle 同时放入同一工程一个文件下 .a需要用到的图片资源就会去.bundle 中找 这样就可以了!










本文转自 卓行天下  51CTO博客,原文链接:http://blog.51cto.com/9951038/1770721,如需转载请自行联系原作者

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-07-07
  • 2021-10-23
  • 2021-10-14
  • 2021-08-27
  • 2021-09-26
猜你喜欢
  • 2021-10-08
  • 2021-11-17
  • 2021-07-03
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案