【问题标题】:Is it possible to open immediately Dropbox or GoogleDrive in UIDocumentPickerViewController?是否可以在 UIDocumentPickerViewController 中立即打开 Dropbox 或 GoogleDrive?
【发布时间】:2016-08-31 00:48:56
【问题描述】:

我需要制作一个自定义菜单,而不是带有按钮的 UIDocumentMenuViewController:iCloud、Dropbox 和 Google Drive。

是否可以在 UIDocumentPickerViewController 中立即打开 Dropbox 或 GoogleDrive(默认情况下会打开 iCloudDrive)?

【问题讨论】:

    标签: ios8 dropbox icloud


    【解决方案1】:

    你应该使用 UIDocumentMenuViewController,比如

    UIDocumentMenuViewController *menus = [[UIDocumentMenuViewController alloc] initWithDocumentTypes:@[@"public.image"] inMode:UIDocumentPickerModeImport];
    menus.delegate = self;
    [self presentViewController:menus animated:YES completion:nil];
    

    在这个菜单中,用户可以选择 iCloud、google drive、Dropbox ...等 你显示句柄 UIDocumentPickerDelegate,UIDocumentMenuDelegate 来显示选择器并做一些事情

    例如

    - (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];
    }
    

    注意。 用户需要安装 google drive 或 dropbox 应用程序,然后才能看到驱动器菜单。

    英语很差,希望你能听懂。

    【讨论】:

      猜你喜欢
      • 2011-10-23
      • 2015-09-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-04-13
      • 1970-01-01
      • 2013-12-28
      • 2022-01-17
      相关资源
      最近更新 更多