添加 分类 自动适配图片

#import <UIKit/UIKit.h>

@interface UIImage (ZB)

+(UIImage *)imageWithName:(NSString *)name;

@end

#import "UIImage+ZB.h"

@implementation UIImage (ZB)

+(UIImage *)imageWithName:(NSString *)name{

    if (IOS7) {

        NSString *url=[NSString stringWithFormat:@"%@_os7",name];

    

       UIImage *image= [UIImage imageNamed:url];

        if (image==nil) {

            return [UIImage imageNamed:name];

        }else{

            return image; 

        }

        

        

    }else{

    

       return [UIImage imageNamed:name];

    }

}

@end

原文地址:https://www.cnblogs.com/zhibin/p/4117686.html