0

我想知道如何在 iOS 上的 UITableView 中为音乐文件创建通用音乐图像,例如图像文件的通用图片图像。这是我正在尝试做的图片http://smartlifeblog.com/wp-content/uploads/2012/02/dropbox-ios.jpg

到目前为止,我有代码来显示我的文档目录中的文件

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;

我可以在表格中添加图像,但我不确定如何为适当的文件类型加载适当的图像。

4

1 回答 1

1

UIDocumentInteractionController。它使用文件 URL 进行初始化。然后,该icons属性会为您提供该文件的图标数组,从小到大排序。这适用于操作系统已知的所有文档类型。您可以在应用程序的 Info.plist 中使用其图标注册其他类型。

于 2012-08-11T04:03:45.990 回答