//前五行 - 获取路径
//最后 - 获取image
宏定义
/**
参1:image;
参2:图片名字;
参3:bundle名字;
参4:bundle资源文件里面文件夹名字
Friendly Tips:
(没有二级或多级,可传空)
(有二级就再拼接,它是一层一层进行查找,一般也不会有太多级 ^-^)
*/
#define GAIN_IMAGE(image,imgName,bundleName,secondBName){\
NSString * path = [[NSBundle mainBundle]pathForResource:bundleName ofType:@"bundle"];\
NSString *secondP = [path stringByAppendingPathComponent:secondBName];\
NSString *imgNameFile = [secondP stringByAppendingPathComponent:imgName];\
image = [UIImage imageWithContentsOfFile:imgNameFile];\
}\
example:
UIImageView * imageV ;
UIImage * img ;
GAIN_IMAGE(img, @"app_launch@2x.png", @"game", @"image")
imageV.image = img;