UIView+CornerRadius.m 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. //
  2. // UIView+CornerRadius.m
  3. // ZBCornerDemo
  4. //
  5. // Created by Zuobian on 2019/12/24.
  6. // Copyright © 2019 admin. All rights reserved.
  7. //
  8. #import "UIView+CornerRadius.h"
  9. #import "Masonry.h"
  10. #import "ZBCornerRadiusTool.h"
  11. @implementation UIView (CornerRadius)
  12. - (void)drawCircularBeadImageWithRadius:(float)radius fillColor:(UIColor *)fillColor CornerStyle:(UIRectCorner)type {
  13. UIImageView *imgView = [[UIImageView alloc] init];
  14. [self addSubview:imgView];
  15. [imgView mas_makeConstraints:^(MASConstraintMaker *make) {
  16. make.left.top.width.height.equalTo(self);
  17. }];
  18. [self layoutIfNeeded];
  19. imgView.image = [ZBCornerRadiusTool drawAntiRoundedCornerImageWithRadius:radius rectSize:imgView.frame.size fillColor:fillColor cornerStyle:type];
  20. }
  21. - (void)drawCircularBeadImageWithRadius_TL:(float)radius_TL
  22. radius_TR:(float)radius_TR
  23. radius_BL:(float)radius_BL
  24. radius_BR:(float)radius_BR
  25. fillColor:(UIColor *)fillColor {
  26. UIImageView *imgView = [[UIImageView alloc] init];
  27. [self addSubview:imgView];
  28. [imgView mas_makeConstraints:^(MASConstraintMaker *make) {
  29. make.left.top.width.height.equalTo(self);
  30. }];
  31. [self layoutIfNeeded];
  32. imgView.image = [ZBCornerRadiusTool drawAntiRoundedCornerWithRadius_TL:radius_TL radius_TR:radius_TR radius_BL:radius_BL radius_BR:radius_BR rectSize:imgView.frame.size fillColor:fillColor];
  33. }
  34. @end