Skip to content

Instantly share code, notes, and snippets.

@CreatureSurvive
Created July 31, 2018 00:35
Show Gist options
  • Select an option

  • Save CreatureSurvive/db1d000482513a87a6abe237af48361e to your computer and use it in GitHub Desktop.

Select an option

Save CreatureSurvive/db1d000482513a87a6abe237af48361e to your computer and use it in GitHub Desktop.
return a custom image based on the name of the requested image within a bundle. this should only be used when filtering a specific app in your bundle filter plist
%hook UIImage
// you should not include the file extention or scale in the file name for this to work
// I have not tested this, but it should work for any image being loaded from the bundle
// baseNameOfLaunchscreenImage@2x.png -> baseNameOfLaunchscreenImage
+ (UIImage *)imageNamed: (NSString *)name {
if ([name containsString:@"baseNameOfLaunchscreenImage"]) {
return [UIImage imageWithContentsOfFile:@"/User/Documents/CustomLaunchImage.png"];
}
return %orig;
}
+ (UIImage *)imageNamed:(NSString *)name inBundle:(NSBundle *)bundle compatibleWithTraitCollection:(UITraitCollection *)traitCollection {
if ([name containsString:@"baseNameOfLaunchscreenImage"]) {
return [UIImage imageWithContentsOfFile:@"/User/Documents/CustomLaunchImage.png"];
}
return %orig;
}
%end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment