AppList: Difference between revisions

From iPhone Development Wiki
(Created page with "Applist is a library to fetch app information https://github.com/rpetrich/AppList To get an array of applications and their display identifiers do the following <source lang=...")
 
No edit summary
Line 13: Line 13:
NSString *displayIdentifier = [displayIdentifiers objectAtIndex:{X}];
NSString *displayIdentifier = [displayIdentifiers objectAtIndex:{X}];
UIImage *icon = [apps iconOfSize:{size here - see enums} forDisplayIdentifier:displayIdentifier];
UIImage *icon = [apps iconOfSize:{size here - see enums} forDisplayIdentifier:displayIdentifier];
</source>
<source>
enum {
ALApplicationIconSizeSmall = 29,
ALApplicationIconSizeLarge = 59
};
</source>
</source>

Revision as of 18:44, 3 March 2014

Applist is a library to fetch app information https://github.com/rpetrich/AppList

To get an array of applications and their display identifiers do the following

ALApplicationList *apps = [ALApplicationList sharedApplicationList];

NSArray *displayIdentifiers = [[apps.applications allKeys] sortedArrayUsingComparator:^NSComparisonResult(id obj1, id obj2) {
	    return [[apps.applications objectForKey:obj1] caseInsensitiveCompare:[apps.applications objectForKey:obj2]];}];
[displayIdentifiers retain];

To get the display identifier and icon for a specific app at index {X} do the following:

NSString *displayIdentifier = [displayIdentifiers objectAtIndex:{X}];
UIImage *icon = [apps iconOfSize:{size here - see enums} forDisplayIdentifier:displayIdentifier];
enum {
	ALApplicationIconSizeSmall = 29,
	ALApplicationIconSizeLarge = 59
};