ios 获取自定义bundle资源小结

2017-11-21  本文已影响0人  baby_在海边

一、bundle 创建方式

   ##1、直接在finder里面创建一个文件夹,修改其后缀为.bundle
Snip20171121_1.png Snip20171121_2.png

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"];
上一篇 下一篇

猜你喜欢

热点阅读