RADetailSignatureModel.m 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. //
  2. // RADetailSignatureModel.m
  3. // Apex And Drivers
  4. //
  5. // Created by Jack on 2018/9/4.
  6. // Copyright © 2018年 USAI. All rights reserved.
  7. //
  8. #import "RADetailSignatureModel.h"
  9. #import "UIImage+RedAnt.h"
  10. @implementation RADetailSignatureModel
  11. - (void)setSignatureURL:(NSString *)signatureURL {
  12. _signatureURL = signatureURL;
  13. if (_signatureURL.length > 0) {
  14. __weak typeof(self) weakSelf = self;
  15. [RASingleton.sharedInstance.networkQueue addOperationWithBlock:^{
  16. UIImage *signature = [UIImage ra_imageWithURL:[NSURL URLWithString:signatureURL]];
  17. if (weakSelf) {
  18. __strong typeof(weakSelf) strongSelf = weakSelf;
  19. [strongSelf setSignature:signature];
  20. }
  21. }];
  22. } else {
  23. self.signature = nil;
  24. }
  25. }
  26. - (void)setSignature:(UIImage *)signature {
  27. _signature = signature;
  28. if (self.delegate && [self.delegate respondsToSelector:@selector(refreshUI)]) {
  29. dispatch_async(dispatch_get_main_queue(), ^{
  30. [self.delegate refreshUI];
  31. });
  32. }
  33. }
  34. - (CGFloat)height {
  35. return 150.0f;
  36. }
  37. @end