| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- //
- // RADetailPhotoModel.m
- // Apex And Drivers
- //
- // Created by Jack on 2018/9/4.
- // Copyright © 2018年 USAI. All rights reserved.
- //
- #import "RADetailPhotoModel.h"
- #import "UIImage+RedAnt.h"
- @interface RADetailPhotoModel ()
- @end
- @implementation RADetailPhotoModel
- - (void)setPhotoURL:(NSString *)photoURL {
- _photoURL = photoURL;
-
- if (_photoURL.length > 0) {
-
- __weak typeof(self) weakSelf = self;
- [RASingleton.sharedInstance.networkQueue addOperationWithBlock:^{
-
- UIImage *photo = [UIImage ra_imageWithURL:[NSURL URLWithString:photoURL]];
- if (weakSelf) {
- __strong typeof(weakSelf) strongSelf = weakSelf;
- [strongSelf setPhoto:photo];
- }
-
- }];
-
- } else {
- [self setPhoto:nil];
- }
- }
- - (void)setPhoto:(UIImage *)photo {
- _photo = photo;
-
- if (self.delegate && [self.delegate respondsToSelector:@selector(refreshUI)]) {
- dispatch_async(dispatch_get_main_queue(), ^{
- [self.delegate refreshUI];
- });
- }
- }
- - (CGFloat)height {
- return 100.0f;
- }
- @end
|