Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
SpringBoard iOS 6 & iOS 7 get icon badge image.
//SBIconBadgeImage = UIImage subclass
__NSMallocBlock__ *block(NSString *string) = [SBIconBadgeImage creationBlockForText:nil];
/** Test Results: **/
//Error: incorrect number of arguments to ffi function
//-[__NSCFNumber rangeOfCharacterFromSet:]: unrecognized selector sent to instance 0x1e9b2ab0
block("Default 1");
//@"<SBIconBadgeImage: 0x1e90a6c0>"
block("D 1");
//@"<SBIconBadgeImage: 0x1ed54ce0>"
block(" 1");
//@"<SBIconBadgeImage: 0x1ea70080>"
block("1 ");
block(" Hello");
//@"<SBIconBadgeImage: 0x1e8e4670>"
block(" Hello World");
//@"<SBIconBadgeImage: 0x1ed66e30>" (works but truncated)
block(" 1 2");
//@"<SBIconBadgeImage: 0x1e8e4b40>"
///** Conclusion **/
Returns a block, don't know what the arguement is, SpringBoard sends nil (*context maybe, delegate like callback?).
The block returns a image, SBIconBadgeImage, or mostly nil.
The block accepts an NSString.
The block takes the string, splits it in 2 at the first space it finds.
The block creates a badge with the contents of the second part of the string.
I don't know what it does with the first part of the string.
[SBIconBadgeImage creationBlockForText:nil](" 1")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.