一、bundle 创建方式
##1、直接在finder里面创建一个文件夹,修改其后缀为.bundle
2、直接Xcode创建
二、注意以上两种访问资源有坑
访问资源代码:
NSString *path = [[[NSBundle mainBundle]resourcePath] stringByAppendingPathComponent:@"photo.bundle/photo_sel_photoPickerVc.png"];
UIImage *image1 = [UIImage imageWithContentsOfFile:path];
或
UIImage *image = [UIImage imageNamed:@"photo.bundle/photo_sel_photoPickerVc.png"];
- 第一种方式创建的bundle访问不到相关的资源,第二种可以。原因如有大神知道,请告知,谢谢。