Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/117.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios UIDocumentInteractionController不';t考虑导航栏的色调颜色_Ios_Uiappearance_Uidocumentinteraction - Fatal编程技术网

Ios UIDocumentInteractionController不';t考虑导航栏的色调颜色

Ios UIDocumentInteractionController不';t考虑导航栏的色调颜色,ios,uiappearance,uidocumentinteraction,Ios,Uiappearance,Uidocumentinteraction,我的应用程序中的一个屏幕显示本地图像的预览,我在左上角有一个操作按钮,用于显示文档交互选项: - (IBAction)actionButtonTapped:(id)sender { self.interactionController = [UIDocumentInteractionController interactionControllerWithURL:self.attachmentLocalUrl]; self.interactionController.delegat

我的应用程序中的一个屏幕显示本地图像的预览,我在左上角有一个操作按钮,用于显示文档交互选项:

- (IBAction)actionButtonTapped:(id)sender {
    self.interactionController = [UIDocumentInteractionController interactionControllerWithURL:self.attachmentLocalUrl];
    self.interactionController.delegate = self;
    [self.interactionController presentOptionsMenuFromRect:self.view.frame inView:self.view animated:YES];
}
这样做很好,因为它显示了一个带有选项列表的操作表,包括通过电子邮件发送附件的电子邮件。当我单击“电子邮件”按钮时,它会显示包含我的图像的电子邮件预览。但有一件事是行不通的。我已经定制了我的应用程序的外观,以便导航栏在整个应用程序中具有相同的颜色。以下是我在应用程序代理的didFinishLaunchingWithOptions中首先运行的代码:

[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent];
[UINavigationBar appearance].barTintColor = [UIColor blueColor];
[UINavigationBar appearance].tintColor = [UIColor whiteColor];
[UINavigationBar appearance].titleTextAttributes = @{NSForegroundColorAttributeName: [UIColor whiteColor]};
这适用于我自己的视图控制器,但UIDocumentInteractionController显示的电子邮件预览视图控制器的条形按钮项为蓝色而不是白色。由于其他参数应用正确,尤其是导航栏的蓝色背景,取消和发送操作按钮几乎不可见


我曾尝试在一个简单的项目中复制这个,但我做不到。很明显,我在我的应用程序中做了一些干扰正常定制的事情。但我不知道是什么。你知道我该怎么调试吗?

你能确切地解释一下你的意思吗?导航栏上的颜色在documentpicker或mfmailcomposer上是否有问题?这里有一些代码,但是我必须使用

如果在UIDocumentPicker上,请在调用present之前设置:

if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7.0)
{
    [[UIBarButtonItem appearance] setTintColor:[UIColor blackColor]];
    [[UINavigationBar appearance] setTintColor:[UIColor blackColor]];
}
然后将其更改回didPickDocument和didCancel中的颜色

如果它位于MFMailcomposer控制器上,则使用以下命令:

if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7.0)
{
    [controller.navigationBar setTintColor:[UIColor blackColor]];
}

希望这有助于

在显示
UIDocumentController
之前,我已确定了解决方法,以清除自定义项,然后在显示UIDocumentController的视图控制器的
视图将显示()中恢复我的自定义主题

func launchDocumentController() {
   UINavigationBar.appearance().titleTextAttributes = nil
   UINavigationBar.appearance().barTintColor = nil
   UINavigationBar.appearance().tintColor = nil
   documentController.presentOptionsMenuFromRect(self.view.frame, inView: self.view, animated: true)
}
然后

除了操作系统更新之外,我认为这是您将得到的最佳“答案”。很抱歉(当我有机会的时候,我会申请雷达。)


在您可以直接访问
MFMComposeViewController
的情况下,如上所述设置色调颜色是一个很好的解决方法。

以下是对我非常有效的方法:

func documentInteractionControllerViewControllerForPreview(_ controller: UIDocumentInteractionController) -> UIViewController {
    UINavigationBar.appearance().barTintColor = Colors.redColor()
    UINavigationBar.appearance().tintColor = UIColor.white
    UINavigationBar.appearance().titleTextAttributes = [NSForegroundColorAttributeName : UIColor.white, NSFontAttributeName: UIFont.systemFont(ofSize: 14, weight: UIFontWeightBold)]
    return self
}

在选项菜单中选择“邮件”后,它位于UIDocumentInteractionController创建的MFMailComposeViewController中。因此,我不知道如何获取该视图控制器的引用,以便像您这样强制导航栏的着色。您可以尝试此代码可能对您有帮助。您可以尝试此代码有相同的问题。我已经注意到,这只发生在设备上,而不是在模拟器上。
func documentInteractionControllerViewControllerForPreview(_ controller: UIDocumentInteractionController) -> UIViewController {
    UINavigationBar.appearance().barTintColor = Colors.redColor()
    UINavigationBar.appearance().tintColor = UIColor.white
    UINavigationBar.appearance().titleTextAttributes = [NSForegroundColorAttributeName : UIColor.white, NSFontAttributeName: UIFont.systemFont(ofSize: 14, weight: UIFontWeightBold)]
    return self
}