Forked from CPDigitalDarkroom/generateIconImageWithInfo.m
Created
February 23, 2020 10:25
-
-
Save lwlsw/3abdbd2c54d0f5ee1a50ef7587134305 to your computer and use it in GitHub Desktop.
Generate icon image on iOS 13
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct SBIconImageInfo { | |
struct CGSize size; | |
double scale; | |
double continuousCornerRadius; | |
}; | |
- (UIImage *)iconImageForIdentifier:(NSString *)identifier { | |
SBIconController *iconController = [NSClassFromString(@"SBIconController") sharedInstance]; | |
SBIcon *icon = [iconController.model expectedIconForDisplayIdentifier:identifier]; | |
struct CGSize imageSize; | |
imageSize.height = 60; | |
imageSize.width = 60; | |
struct SBIconImageInfo imageInfo; | |
imageInfo.size = imageSize; | |
imageInfo.scale = [UIScreen mainScreen].scale; | |
imageInfo.continuousCornerRadius = 12; | |
return [icon generateIconImageWithInfo:imageInfo]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment