@@ -88,11 +88,11 @@ - (UIColor *)colorForKey:(NSString *)key forTheme:(NSString *)themeName
8888 NSString *colorValue = [self objectForKey: key forTheme: themeName];
8989 UIColor *color = [self colorFromString: colorValue];
9090 if (color == nil && [self isValidString: colorValue]) {
91- NSArray * referenceColor = [colorValue componentsSeparatedByString: @" :" ];
91+ NSArray * referenceColor = [colorValue componentsSeparatedByString: @" :" ];
9292 colorValue = referenceColor.firstObject ;
9393 color = [self colorForKey: colorValue forTheme: themeName];
9494 if (referenceColor.count > 1 ) {
95- color = [color colorWithAlphaComponent: [referenceColor[1 ] doubleValue ]];
95+ color = [color colorWithAlphaComponent: [referenceColor[1 ] doubleValue ]];
9696 }
9797 }
9898
@@ -118,41 +118,28 @@ - (UIColor*)colorFromString:(NSString*)colorValue
118118 return nil ;
119119}
120120
121- - (UIImage *)imageforKey : (NSString *)key
121+ - (UIImage *)imageNamed : (NSString *)key
122122{
123- return [self imageforKey : key forTheme: self .currentTheme];;
123+ return [self imageNamed : key forTheme: self .currentTheme];;
124124}
125125
126- - (UIImage *)imageforKey : (NSString *)key forTheme : (NSString *)themeName
126+ - (UIImage *)imageNamed : (NSString *)key forTheme : (NSString *)themeName
127127{
128128 if ([self isValidString: themeName] == NO || [self isValidString: key] == NO ) {
129129 return nil ;
130130 }
131131
132- NSString *imageName = [self objectForKey: key forTheme: themeName];
132+ NSString *imgName = [self objectForKey: key forTheme: themeName];
133133
134- if (imageName == nil ) {
135- imageName = key;
136- }
137- return [self imageNamed: imageName forTheme: themeName];
138- }
139-
140- - (UIImage *)imageNamed : (NSString *)imgName
141- {
142- return [self imageNamed: imgName forTheme: self .currentTheme];;
143- }
144-
145- - (UIImage *)imageNamed : (NSString *)imgName forTheme : (NSString *)themeName
146- {
147- if ([self isValidString: themeName] == NO || [self isValidString: imgName] == NO ) {
148- return nil ;
134+ if (imgName == nil ) {
135+ imgName = key;
149136 }
150137
151138 UIImage* img = nil ;
152- NSBundle * bundle = [NSBundle bundleWithPath: self .themeList[themeName]];
139+ NSBundle * bundle = [NSBundle bundleWithPath: self .themeList[themeName]];
153140
154141 if (NSFoundationVersionNumber >= NSFoundationVersionNumber_iOS_8_0) {
155- img = [UIImage imageNamed: imgName inBundle: bundle compatibleWithTraitCollection: nil ];
142+ img = [UIImage imageNamed: key inBundle: bundle compatibleWithTraitCollection: nil ];
156143 }
157144 else {
158145#ifdef AWLThemeManager_XCASSETS_iOS7
@@ -163,7 +150,7 @@ - (UIImage *)imageNamed:(NSString *)imgName forTheme:(NSString*)themeName
163150 // IF you want to enable with cocoapods you'll need this:
164151 // https://guides.cocoapods.org/syntax/podfile.html#post_install
165152 static NSString * iOS7PrivateCompatSelector = @" _" @" device" @" Specific" @" ImageNamed:" @" inBundle:" ;
166- img = [UIImage performSelector: NSSelectorFromString (iOS7PrivateCompatSelector) withObject: imgName withObject: bundle];
153+ img = [UIImage performSelector: NSSelectorFromString (iOS7PrivateCompatSelector) withObject: imgName withObject: bundle];
167154#endif
168155 }
169156
0 commit comments