gpt4 book ai didi

ios - 按钮在 UIDocumentPickerViewController 中不可见

转载 作者:行者123 更新时间:2023-12-03 19:15:28 34 4
gpt4 key购买 nike

我想将文档导入到我的应用程序中。我创建了一个演示来导入文档。演示正在运行。下面是打开UIDocumentPickerViewController的Demo代码。

-(IBAction) btnOpenClicked{
UIDocumentPickerViewController *documentPicker = [[UIDocumentPickerViewController alloc] initWithDocumentTypes:[self allowedUTIs] inMode:UIDocumentPickerModeImport];
documentPicker.delegate = self;

[self presentViewController:documentPicker animated:true completion:nil];
}

-(NSArray*)allowedUTIs{
return @[@"public.data",@"public.content",@"public.audiovisual-content",@"public.movie",@"public.audiovisual-content",@"public.video",@"public.audio",@"public.text",@"public.data",@"public.zip-archive",@"com.pkware.zip-archive",@"public.composite-content",@"public.text"];
}

在我的实际项目中实现了相同的代码。 UIDocumentPickerViewController 打开并且应用程序能够导入文件,但问题是在实际应用程序中我看不到标题中的任何按钮。以为有 Action 发生,但按钮不可见。请检查演示和实际应用程序的屏幕截图。
enter image description here enter image description here

最佳答案

您的应用程序可能正在设置全局 UINavigationBar色调颜色外观。您只需重置 UIDocumentPickerViewController 的外观即可只需将此代码放在 application:didFinishLaunchingWithOptions: 中的某个位置即可功能和栏按钮将返回到原来的蓝色。

if #available(iOS 11.0, *) {
UINavigationBar.appearance(whenContainedInInstancesOf: [UIDocumentBrowserViewController.self]).tintColor = nil
}

关于ios - 按钮在 UIDocumentPickerViewController 中不可见,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48154007/

34 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com