Reputation: 646
I need to make a custom menu instead of UIDocumentMenuViewController with buttons: iCloud, Dropbox and Google Drive.
And is it possible to open immediately Dropbox or GoogleDrive (by default iCloudDrive will be open) in UIDocumentPickerViewController?
Upvotes: 1
Views: 561
Reputation: 49
you should use UIDocumentMenuViewController, like
UIDocumentMenuViewController *menus = [[UIDocumentMenuViewController alloc] initWithDocumentTypes:@[@"public.image"] inMode:UIDocumentPickerModeImport];
menus.delegate = self;
[self presentViewController:menus animated:YES completion:nil];
and in this menu, user can choose iCloud, google drive, dropbox ...etc you show handle UIDocumentPickerDelegate, UIDocumentMenuDelegate to show the picker and do something
For example
- (void)documentPicker:(UIDocumentPickerViewController *)controller didPickDocumentAtURL:(NSURL *)url {
if (controller.documentPickerMode == UIDocumentPickerModeImport) {
// do something
}
}
- (void)documentMenu:(UIDocumentMenuViewController *)documentMenu didPickDocumentPicker:(UIDocumentPickerViewController *)documentPicker {
documentPicker.delegate = self;
[self presentViewController:documentPicker animated:YES completion:nil];
}
Note. User need install google drive or dropbox app and then drive menu can be seen.
poor english, wish you can understand.
Upvotes: 1