gpt4 book ai didi

ios7 - 当从 iOS7 中的 UIActivityViewController 呈现时,无法设置邮件编辑器中“发送”和“取消”按钮的文本颜色

转载 作者:行者123 更新时间:2023-12-03 05:30:34 24 4
gpt4 key购买 nike

我正在使用 UIActivityViewController 在 iOS7 中共享项目。当我点击“邮件”选项时,它会弹出邮件编辑器,但导航栏上的“取消”和“发送”按钮以及导航栏本身都是蓝色的,使其很难阅读,所以我想更改它们的颜色。它可以在 iOS6 中运行,但不能在 iOS7 中运行。

我试过了

[[UIBarButtonItem appearance] setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:[UIColor redColor], UITextAttributeTextColor, [UIColor clearColor], UITextAttributeTextShadowColor, nil] forState:UIControlStateNormal];

它适用于 iOS6,我尝试过

[[UIBarButtonItem appearance] setTintColor:[UIColor redColor]];
[[UINavigationBar appearance] setBarTintColor:[UIColor redColor]];

这会导致应用程序第一次运行时颜色闪烁红色,然后立即切换回蓝色。

最佳答案

成功更改 UINavigationBar 上的发送取消按钮的文本颜色在 MFMailComposerViewController (发送取消)和 MFMessageComposeViewController (仅取消),当从 UIActivityViewController 出现时.

使用 UIActivityViewController,点击 MessageMail :

Using an UIActivityViewController

您会注意到发送取消按钮的默认文本颜色是蓝色:

Default blue colors

为了改变这一点,在 AppDelegate.m类,在 didFinishLaunchingWithOptions方法,插入以下行:

[[UIBarButtonItem appearanceWhenContainedIn:[UINavigationBar class], nil] setTintColor:[UIColor whiteColor]];

这会导致:

Changed to white

您还可以使用其他颜色,例如:

[UIColor purpleColor];

Change to purple

[UIColor greenColor];

Changed to green

我是如何测试这个的?我注意到这个解决方案适用于以下情况:

  • 使用 Xcode 5.1,在 iOS 7.1 模拟器中构建为基础 iOS SDK 7.1(可以从选择项目文件 -> build设置 -> 基础 SDK 中进行选择。此外,还可以从常规 -> 部署目标 -> 7.1 中进行选择)
  • 使用 Xcode 5.1,在 iPhone 4 上构建为基础 iOS SDK 7.0(可以通过选择项目文件 -> build设置 -> 基础 SDK 进行选择。此外,还可以从常规 -> 部署目标 -> 7.0 中进行选择)
  • 使用 Xcode 5.1,在 iPhone 4 上构建为基础 iOS SDK 7.1(可以通过选择项目文件 -> build设置 -> 基础 SDK 进行选择。此外,还可以从常规 -> 部署目标 -> 7.1 中进行选择)

测试时不起作用:

  • 使用 Xcode 5.1,在 iOS 7.0 模拟器中,构建为基础 iOS SDK 7.0(可以从选择项目文件 -> build设置 -> 基础 SDK 中进行选择。此外,还可以从常规 -> 部署目标 -> 7.0 中进行选择)

因此它应该可以安全使用,因为我相信实际设备上的行为比 iOS 模拟器中的行为更重要。如果有人知道为什么它在 iOS 7.0 模拟器中不起作用,我想知道。 :)

关于ios7 - 当从 iOS7 中的 UIActivityViewController 呈现时,无法设置邮件编辑器中“发送”和“取消”按钮的文本颜色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19368122/

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