如何在UIDocumentPickerViewController中更新框架尺寸样式

时间:2019-02-27 08:54:49

标签: ios objective-c uidocumentpickerviewcontroller

在我的应用程序中,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

1 个答案:

答案 0 :(得分: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];
}

就这样:)