QQCornerModel.m 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. //
  2. // QQCornerModel.m
  3. // QQCorner
  4. //
  5. // Created by 秦琦 on 2018/10/24.
  6. // Copyright © 2018 QinQi. All rights reserved.
  7. //
  8. #import "QQCornerModel.h"
  9. @implementation QQGradualChangingColor
  10. - (instancetype)initWithColorFrom:(UIColor *)from to:(UIColor *)to type:(QQGradualChangeType)type {
  11. if (self = [super init]) {
  12. _fromColor = from;
  13. _toColor = to;
  14. _type = type;
  15. }
  16. return self;
  17. }
  18. + (instancetype)gradualChangingColorFrom:(UIColor *)from to:(UIColor *)to {
  19. return [[self alloc] initWithColorFrom:from to:to type:QQGradualChangeTypeUpLeftToDownRight];
  20. }
  21. + (instancetype)gradualChangingColorFrom:(UIColor *)from to:(UIColor *)to type:(QQGradualChangeType)type {
  22. return [[self alloc] initWithColorFrom:from to:to type:type];
  23. }
  24. @end
  25. @implementation QQCorner
  26. - (instancetype)initWithRadius:(QQRadius)radius fillColor:(UIColor *)fillColor borderColor:(UIColor *)borderColor borderWidth:(CGFloat)borderWidth {
  27. if (self = [super init]) {
  28. _radius = radius;
  29. _fillColor = fillColor;
  30. _borderColor = borderColor;
  31. _borderWidth = borderWidth;
  32. }
  33. return self;
  34. }
  35. + (instancetype)cornerWithRadius:(QQRadius)radius fillColor:(UIColor *)fillColor {
  36. return [[self alloc] initWithRadius:radius fillColor:fillColor borderColor:nil borderWidth:0];
  37. }
  38. + (instancetype)cornerWithRadius:(QQRadius)radius fillColor:(UIColor *)fillColor borderColor:(UIColor *)borderColor borderWidth:(CGFloat)borderWidth {
  39. return [[self alloc] initWithRadius:radius fillColor:fillColor borderColor:borderColor borderWidth:borderWidth];
  40. }
  41. @end