我在app中工作以选择照片,我使用UIDocumentMenuViewController
来显示文档提供者的扩展名列表。此列表显示Dropbox,iCloud,GoogleDrive但不是原生照片应用,为什么?
我的代码示例:
UIDocumentMenuViewController *menuVC = [[UIDocumentMenuViewController alloc] initWithDocumentTypes:@[@"public.image"] inMode:UIDocumentPickerModeImport];
答案 0 :(得分:10)
我不确定本机是否还有其他办法可以做到这一点,但我想出了一个解决方案来添加一个带处理程序的自定义选项。我添加了"照片"选项,在处理程序中我使用UIImagePickerViewController
:
UIDocumentMenuViewController *menuVC = [[UIDocumentMenuViewController alloc] initWithDocumentTypes:UTIs inMode:UIDocumentPickerModeImport];
[menuVC addOptionWithTitle:@"Photos" image:nil order:UIDocumentMenuOrderFirst handler:^{
UIImagePickerController *imagePickerController = [[UIImagePickerController alloc] init];
imagePickerController.delegate = self;
[self presentViewController:imagePickerController animated:YES completion:nil];
}];
我会这样做并为" Camera"。
添加另一个选项