@@ -129,10 +129,31 @@ - (UIImage *)imageNamed:(NSString *)imgName forTheme:(NSString*)themeName
129129 return nil ;
130130 }
131131
132- NSString *path = self.themeList [themeName];
133- path = [self relativePathToMainBundle: path];
134- NSString *filePath = [path stringByAppendingPathComponent: imgName];
135- UIImage *img = [UIImage imageNamed: filePath];
132+ UIImage* img = nil ;
133+ NSBundle * bundle = [NSBundle bundleWithPath: self .themeList[themeName]];
134+
135+ if (NSFoundationVersionNumber >= NSFoundationVersionNumber_iOS_8_0) {
136+ img = [UIImage imageNamed: imgName inBundle: bundle compatibleWithTraitCollection: nil ];
137+ }
138+ else {
139+ #ifdef AWLThemeManager_XCASSETS_iOS7
140+ // This is included for reference/completeness. It fetches the device specific
141+ // image from the compiled Assets.car embedded in the theme bundle for iOS7 devices.
142+ // However, it is a *PRIVATE API*
143+ // As such, all relevant warnings and caveats apply to it's usage
144+ // IF you want to enable with cocoapods you'll need this:
145+ // https://guides.cocoapods.org/syntax/podfile.html#post_install
146+ static NSString * iOS7PrivateCompatSelector = @" _" @" device" @" Specific" @" ImageNamed:" @" inBundle:" ;
147+ img = [UIImage performSelector: NSSelectorFromString (iOS7PrivateCompatSelector) withObject: imgName withObject: bundle];
148+ #endif
149+ }
150+
151+ if (img == nil ) {
152+ NSString *path = self.themeList [themeName];
153+ path = [self relativePathToMainBundle: path];
154+ NSString *filePath = [path stringByAppendingPathComponent: imgName];
155+ img = [UIImage imageNamed: filePath];
156+ }
136157
137158 if (img == nil ) {
138159 NSString *baseTheme = self.themeRelationship [themeName];
0 commit comments