Reputation: 183
I'm programming an app similar to the email. So when I attach a file to my message I would like to show the filename + small image (icon), this icon should be according the filetype, for example pdf if the file is a pdf, Word id the file is a word file ....
Anyone know how can I find these small images ? Or any representative example ?
Advanced thank
Upvotes: 1
Views: 403
Reputation: 539685
If this is for iOS then you can use UIDocumentInteractionController:
NSURL *url = [NSURL fileURLWithPath:pathToYourFile];
UIDocumentInteractionController *diac = [UIDocumentInteractionController interactionControllerWithURL:url];
NSArray *icons = diac.icons;
if ([icons count] > 0) {
// This is the smallest available icon:
UIImage *icon = [icons objectAtIndex:0];
} else {
// No icon found.
// According to the documentation, this case *should not* occur...
}
Upvotes: 2