Browse Source

code optimising

ibireme 9 năm trước cách đây
mục cha
commit
d58cf43ccc
1 tập tin đã thay đổi với 2 bổ sung2 xóa
  1. 2 2
      YYWebImage/Image/YYImage.m

+ 2 - 2
YYWebImage/Image/YYImage.m

@@ -101,12 +101,12 @@ static CGFloat _NSStringPathScale(NSString *string) {
     NSString *path = nil;
     CGFloat scale = 1;
     
+    // If no extension, guess by system supported (same as UIImage).
+    NSArray *exts = ext.length > 0 ? @[ext] : @[@"", @"png", @"jpeg", @"jpg", @"gif", @"webp"];
     NSArray *scales = _NSBundlePreferredScales();
     for (int s = 0; s < scales.count; s++) {
         scale = ((NSNumber *)scales[s]).floatValue;
         NSString *scaledName = _NSStringByAppendingNameScale(res, scale);
-        // If no extension, guess by system supported (same as UIImage).
-        NSArray *exts = ext.length > 0 ? @[ext] : @[@"", @"png", @"jpeg", @"jpg", @"gif", @"webp"];
         for (NSString *e in exts) {
             path = [[NSBundle mainBundle] pathForResource:scaledName ofType:e];
             if (path) break;