Explorar o código

1.完成iOS Apex Drivers图像加载。

Pen Li %!s(int64=7) %!d(string=hai) anos
pai
achega
9dacc7e169

+ 5 - 5
Redant Drivers/Apex And Drivers/Home/RAHomeOrderModel.m

@@ -31,11 +31,11 @@
     }
 }
 
-- (void)setValuesForKeysWithDictionary:(NSDictionary<NSString *,id> *)keyedValues {
-    [super setValuesForKeysWithDictionary:keyedValues];
-    
-    [self setIconURL:@"https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1536134884&di=9ea523019212b373ac04f4411e8aa56b&imgtype=jpg&er=1&src=http%3A%2F%2Fp3.music.126.net%2Fyp-UZgqWp6FV_AN4hPozjQ%3D%3D%2F109951163414711232.jpg"];
-}
+//- (void)setValuesForKeysWithDictionary:(NSDictionary<NSString *,id> *)keyedValues {
+//    [super setValuesForKeysWithDictionary:keyedValues];
+//    
+//    [self setIconURL:@"https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1536134884&di=9ea523019212b373ac04f4411e8aa56b&imgtype=jpg&er=1&src=http%3A%2F%2Fp3.music.126.net%2Fyp-UZgqWp6FV_AN4hPozjQ%3D%3D%2F109951163414711232.jpg"];
+//}
 
 - (void)setIconURL:(NSString *)iconURL {
     _iconURL = iconURL;

+ 9 - 5
Redant Drivers/Apex And Drivers/UIImage+RedAnt.m

@@ -51,11 +51,15 @@ static dispatch_semaphore_t _lock;
             [fileManager createDirectoryAtPath:imgDir withIntermediateDirectories:YES attributes:nil error:nil];
         }
         
-        Lock();
-        [imgData writeToFile:imgPath atomically:NO];
-        Unlock();
-        
-        return [UIImage imageWithData:imgData];
+        if (imgData) {
+            Lock();
+            [imgData writeToFile:imgPath atomically:NO];
+            Unlock();
+            
+            return [UIImage imageWithData:imgData];
+        } else {
+            return nil;
+        }
     }
 }