0

I was wondering how a generic music image for a music file in a UITableView on iOS and so on such as a generic picture image for image files. Here is a picture of what i am trying to do http://smartlifeblog.com/wp-content/uploads/2012/02/dropbox-ios.jpg

So far i have code to display the files in my documents directory

static NSString *CellIdentifier = @"FileCell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];
if (cell == nil)
{
    cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
}
cell.textLabel.text = [files objectAtIndex:indexPath.row];
return cell;

I can add an image in the table but im not sure how to load the appropriate image for the appropriate file type.

1 Answers1

1

See UIDocumentInteractionController. It is initialized with a file URL. The icons property then gives you an array of icons for that file, sorted from smallest to largest. This works for all document types known to the OS. You can register additional types with their icons in the Info.plist of your app.

Martin R
  • 529,903
  • 94
  • 1,240
  • 1,382