Skip to content

Instantly share code, notes, and snippets.

Embed
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: **/
block();
//Error: incorrect number of arguments to ffi function
block(1);
//-[__NSCFNumber rangeOfCharacterFromSet:]: unrecognized selector sent to instance 0x1e9b2ab0
block("1");
//null
block("Default 1");
//@"<SBIconBadgeImage: 0x1e90a6c0>"
block("D 1");
//@"<SBIconBadgeImage: 0x1ed54ce0>"
block(" 1");
//@"<SBIconBadgeImage: 0x1ea70080>"
block("1 ");
//null
block(" Hello");
//@"<SBIconBadgeImage: 0x1e8e4670>"
block(" Hello World");
//@"<SBIconBadgeImage: 0x1ed66e30>" (works but truncated)
block(" 1 2");
//@"<SBIconBadgeImage: 0x1e8e4b40>"
///** Conclusion **/
/*
+creationBlockForText:
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.