// // UIView+AnimationProperty.m // AlertViewDemo // // Created by YouXianMing on 15/10/15. // Copyright © 2015年 ZiPeiYi. All rights reserved. // #import "UIView+AnimationProperty.h" #import @implementation UIView (AnimationProperty) #pragma mark - Scale. NSString * const _recognizerScale = @"_recognizerScale"; - (void)setScale:(CGFloat)scale { objc_setAssociatedObject(self, (__bridge const void *)(_recognizerScale), @(scale), OBJC_ASSOCIATION_RETAIN_NONATOMIC); self.transform = CGAffineTransformMakeScale(scale, scale); } - (CGFloat)scale { NSNumber *scaleValue = objc_getAssociatedObject(self, (__bridge const void *)(_recognizerScale)); return scaleValue.floatValue; } #pragma mark - Angle. NSString * const _recognizerAngle = @"_recognizerAngle"; - (void)setAngle:(CGFloat)angle { objc_setAssociatedObject(self, (__bridge const void *)(_recognizerAngle), @(angle), OBJC_ASSOCIATION_RETAIN_NONATOMIC); self.transform = CGAffineTransformMakeRotation(angle); } - (CGFloat)angle { NSNumber *angleValue = objc_getAssociatedObject(self, (__bridge const void *)(_recognizerAngle)); return angleValue.floatValue; } @end