0

在我的应用程序中,我的 UIDocumentPickerViewController 的帧大小始终全屏,如下图和以下代码。但是,我发现 UIDocumentPickerViewController 的帧大小不同,但我不知道如何获得第二张图片的效果。有谁知道如何获得效果?

https://drive.google.com/file/d/1_q_kfIIYA0d0KcT7NyPpFb6Q1vymU-lb/view?usp=sharing

- (void)btnPressDown {
    NSLog(@"Press Down QQ");
     [self showDocumentPickerInMode:UIDocumentPickerModeImport];
}
- (void)showDocumentPickerInMode:(UIDocumentPickerMode)mode {
    NSLog(@"showDocumentPickerInMode QQ");
    UIDocumentPickerViewController *picker = [[UIDocumentPickerViewController alloc]     initWithDocumentTypes:@[@"public.data"] inMode:mode];
    picker.delegate = self;

    [self presentViewController:picker animated:YES completion:nil];
}

https://drive.google.com/file/d/177W-O0eJmePhLfS8ifGlw9n3jj26FDn9/view?usp=sharing

4

1 回答 1

1

您需要设置演示样式。展示风格决定了一个模态展示的视图控制器如何在屏幕上显示。“picker.modalPresentationStyle = UIModalPresentationFormSheet;”

- (void)showDocumentPickerInMode:(UIDocumentPickerMode)mode {
    UIDocumentPickerViewController *picker = [[UIDocumentPickerViewController alloc]     initWithDocumentTypes:@[@"public.data"] inMode:mode];
    picker.modalPresentationStyle = UIModalPresentationFormSheet;
    picker.delegate = self;
    [self presentViewController:picker animated:YES completion:nil];
}

就是这样 :)

于 2019-02-27T11:09:07.163 回答