|
15 | 15 |
|
16 | 16 | NS_ASSUME_NONNULL_BEGIN |
17 | 17 |
|
18 | | -// High-performance flat-colored, rounded-corner resizable images |
19 | | -// |
20 | | -// For "Baked-in Opaque" corners, set cornerColor equal to the color behind the rounded image object, i.e. the background color. |
21 | | -// For "Baked-in Alpha" corners, set cornerColor = [UIColor clearColor] |
22 | | -// |
23 | | -// See http://asyncdisplaykit.org/docs/corner-rounding.html for an explanation. |
| 18 | +/** |
| 19 | + * Dramatically faster version of +[UIImage imageNamed:]. Although it is believed that imageNamed: |
| 20 | + * has a cache and is fast, it actually performs expensive asset catalog lookups and is often a |
| 21 | + * performance bottleneck (verified on iOS 7 through iOS 10). |
| 22 | + * |
| 23 | + * Use [UIImage as_imageNamed:] anywhere in your app, even if you aren't using other parts of ASDK. |
| 24 | + * Although not the best choice for extremely large assets that are only used once, it is the ideal |
| 25 | + * choice for any assets used in tab bars, nav bars, buttons, table or collection cells, etc. |
| 26 | + */ |
| 27 | + |
| 28 | +@interface UIImage (ASDKFastImageNamed) |
| 29 | + |
| 30 | +/** |
| 31 | + * A version of imageNamed that caches results because loading an image is expensive. |
| 32 | + * Calling with the same name value will usually return the same object. A UIImage, |
| 33 | + * after creation, is immutable and thread-safe so it's fine to share these objects across multiple threads. |
| 34 | + * |
| 35 | + * @param imageName The name of the image to load |
| 36 | + * @return The loaded image or nil |
| 37 | + */ |
| 38 | ++ (UIImage *)as_imageNamed:(NSString *)imageName; |
| 39 | + |
| 40 | +/** |
| 41 | + * A version of imageNamed that caches results because loading an image is expensive. |
| 42 | + * Calling with the same name value will usually return the same object. A UIImage, |
| 43 | + * after creation, is immutable and thread-safe so it's fine to share these objects across multiple threads. |
| 44 | + * |
| 45 | + * @param imageName The name of the image to load |
| 46 | + * @param traitCollection The traits associated with the intended environment for the image. |
| 47 | + * @return The loaded image or nil |
| 48 | + */ |
| 49 | ++ (UIImage *)as_imageNamed:(NSString *)imageName compatibleWithTraitCollection:(nullable UITraitCollection *)traitCollection; |
24 | 50 |
|
25 | | -@interface UIImage (ASDKAdditions) |
| 51 | +@end |
| 52 | + |
| 53 | +/** |
| 54 | + * High-performance flat-colored, rounded-corner resizable images |
| 55 | + * |
| 56 | + * For "Baked-in Opaque" corners, set cornerColor equal to the color behind the rounded image object, |
| 57 | + * i.e. the background color. |
| 58 | + * For "Baked-in Alpha" corners, set cornerColor = [UIColor clearColor] |
| 59 | + * |
| 60 | + * See http://asyncdisplaykit.org/docs/corner-rounding.html for an explanation. |
| 61 | + */ |
| 62 | + |
| 63 | +@interface UIImage (ASDKResizableRoundedRects) |
26 | 64 |
|
27 | 65 | /** |
28 | 66 | * This generates a flat-color, rounded-corner resizeable image |
@@ -69,27 +107,6 @@ NS_ASSUME_NONNULL_BEGIN |
69 | 107 | roundedCorners:(UIRectCorner)roundedCorners |
70 | 108 | scale:(CGFloat)scale AS_WARN_UNUSED_RESULT; |
71 | 109 |
|
72 | | -/** |
73 | | - * A version of imageNamed that caches results because loading an image is expensive. |
74 | | - * Calling with the same name value will usually return the same object. A UIImage, |
75 | | - * after creation, is immutable and thread-safe so it's fine to share these objects across multiple threads. |
76 | | - * |
77 | | - * @param imageName The name of the image to load |
78 | | - * @return The loaded image or nil |
79 | | - */ |
80 | | -+ (UIImage *)as_imageNamed:(NSString *)imageName; |
81 | | - |
82 | | -/** |
83 | | - * A version of imageNamed that caches results because loading an image is expensive. |
84 | | - * Calling with the same name value will usually return the same object. A UIImage, |
85 | | - * after creation, is immutable and thread-safe so it's fine to share these objects across multiple threads. |
86 | | - * |
87 | | - * @param imageName The name of the image to load |
88 | | - * @param traitCollection The traits associated with the intended environment for the image. |
89 | | - * @return The loaded image or nil |
90 | | - */ |
91 | | -+ (UIImage *)as_imageNamed:(NSString *)imageName compatibleWithTraitCollection:(nullable UITraitCollection *)traitCollection; |
92 | | - |
93 | 110 | @end |
94 | 111 |
|
95 | 112 | NS_ASSUME_NONNULL_END |
0 commit comments