这是运用到了对象关联, 如果不会的请看这篇文章:http://nshipster.cn/associated-objects/
.h文件
#import <UIKit/UIKit.h>
@interface UIImage (Rotation)
@property (nonatomic,copy)NSString *isRotation;
.m文件
#import "UIImage+Rotation.h"
#import <objc/runtime.h>
@implementation UIImage (Rotation)
- (void)setIsRotation:(NSString *)isRotation {
objc_setAssociatedObject(self, @selector(isRotation), isRotation, OBJC_ASSOCIATION_COPY_NONATOMIC);
}
- (NSString *)isRotation {
return objc_getAssociatedObject(self, @selector(isRotation));
}