前言:
1、上面的需求,说要做一个FrameWork给对面用。
2、写这篇文章是为了记录我的实践过程。
3、这篇文章是抄的。
第一节,制作 Bundle
新建工程 Bundle
1 新建bundle.png
2 basesdk.pngBase SDK 改成 iOS
3 combine.pngCOMBINE_HIDPI_IMAGES 改成 NO
4 dir.pngInstallation Directory 这个貌似不用管
5 install.png 6 添加资源.png 7 添加资源2.png 8 取包.pngSkip Install 改成YES
第二节,制作 动态 FrameWork
1 创建动态fr.png2 build.pngBuild Active Architecture Only 改成NO
3 Dynamic.png 4 导入.png 5 选择.png 6 代码.pngMach-O Type 改为 Dynamic Library
NSBundle *dynamicBundle = [NSBundle bundleForClass:[DynamicView class]];
NSURL *bundelURL = [dynamicBundle URLForResource:@"ResourcePackage" withExtension:@"bundle"];
NSBundle *imageBundle = [NSBundle bundleWithURL:bundelURL];
NSString *path = [imageBundle pathForResource:@"y" ofType:@"jpg"];
UIImageView *imageView = [[UIImageView alloc] initWithFrame:self.bounds];
imageView.image = [UIImage imageWithContentsOfFile:path];
7 暴露文件.png
8 暴露文件2.png
9 打包.png
10 导入2.png
11 添加1.png
12 验证.png
第三节,制作 静态 FrameWork
1 build.pngBuild Active Architecture Only 改成NO
2 macho.png 3 导入bundle.png 4 写代码访问.pngMach-O Type 改为 Static Library
NSString *bundlePaht = [[NSBundle mainBundle] pathForResource:@"Static.framework/ResourcePackage" ofType:@"bundle"];
NSBundle *imageBundle = [NSBundle bundleWithPath:bundlePaht];
NSString *path = [imageBundle pathForResource:@"y" ofType:@"jpg"];
UIImageView *imageView = [[UIImageView alloc] initWithFrame:self.bounds];
imageView.image = [UIImage imageWithContentsOfFile:path];
5 暴露头文件.png
6 暴露头文件2.png
7 导包.png
8 选择导入.png
9 导包2.png
10 导包3.png
11 导包4.png
12 完成.png
感谢大佬:
包含 Bundle 资源的 framework 的正确打包方式
网友评论