ios - MFMailComposeViewController 外观 setTintColor 迷失 iOS 7

标签 ios iphone objective-c xcode

这个问题是针对运行 iOS 7 的 Xcode 5 的,非常奇怪。我正在尝试将所有 UInavigation 和 UIBarButtonItem 文本颜色设置为白色。

所以在我的应用启动委托(delegate)中,我将代码设置为。

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    UIImage *NavigationPortraitBackground = [UIImage imageNamed:@"button_header_blue"];

    // Set the background image all UINavigationBars
    [[UINavigationBar appearance] setBackgroundImage:NavigationPortraitBackground forBarMetrics:UIBarMetricsDefault];



    // Set the text appearance for navbar
    [[UINavigationBar appearance] setTitleTextAttributes:
     [NSDictionary dictionaryWithObjectsAndKeys:
      [UIColor whiteColor], UITextAttributeTextColor,
      [UIColor whiteColor], UITextAttributeTextShadowColor,
      [NSValue valueWithUIOffset:UIOffsetMake(0, 0)], UITextAttributeTextShadowOffset,
      [UIFont fontWithName:@"Helvetica Neue" size:21], UITextAttributeFont,
      nil]];


    [[UINavigationBar appearance] setTintColor:[UIColor whiteColor]];


    NSDictionary *attributes = [NSDictionary dictionaryWithObjectsAndKeys:
                                [UIColor whiteColor],
                                UITextAttributeTextColor,
                                [UIColor whiteColor],
                                UITextAttributeTextShadowColor,
                                nil];

    [[UIBarButtonItem appearance] setTitleTextAttributes:attributes forState: UIControlStateNormal];

    [[UIBarButtonItem appearance] setTintColor:[UIColor whiteColor]];

    // Override point for customization after application launch.
    return YES;
}

如果我启动“发送邮件”操作两次 - 我第一次看到 UIBarButton 项目是白色的。我看着它并点击取消按钮 - 第二次我看到它们都变灰了,除了标题外几乎看不见。 - 这在我的 iPhone 模拟器和运行 iOS 7 的 iPhone 中都发生了。

我该如何解决这个问题?

enter image description here enter image description here

最佳答案

我必须这样做才能在 iOS 7 上运行

if ([MFMailComposeViewController canSendMail])
    {

        MFMailComposeViewController *mailViewController = [[MFMailComposeViewController alloc] init];
        mailViewController.mailComposeDelegate = self;

        [mailViewController.navigationBar setTintColor:[UIColor whiteColor]];
        [mailViewController.navigationBar setBarTintColor:[UIColor whiteColor]];

....

关于ios - MFMailComposeViewController 外观 setTintColor 迷失 iOS 7,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20768736/

相关文章:

iphone - 单击任何UIImage并在Objective-C中打开UIImageView

iphone - 为什么这个指针类型不兼容

iOS App Store - 本地化语言设置如何工作?

ios - UITableView单元格大小

iphone - for循环递增

ios - xcode 8.3.3 Playground在行号旁边不显示错误

javascript - 如何在web应用程序中动态更改ios状态栏的背景颜色

iphone - 在哪里可以找到所有 Apple 的技术问答和技术说明?

IOS - 从应用程序商店安装旧应用程序版本

iphone - 触摸时UISearchBar崩溃