热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

如何在ios9上更改全局色调?-HowtochangeglobaltintcoloroniOS9?

IhavethefollowingcodewhichworksperfectlyoniOS8:我有以下代码,在ios8上运行良好:-(BOOL)application:(U

I have the following code which works perfectly on iOS 8:

我有以下代码,在ios8上运行良好:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {

    // some app initialization code comes here
    // ...

    // set the global tint color - works great on iOS 8!
    [[UIView appearance] setTintColor:[self myGlobalTintColor]];
}

However, when I run the same code on iOS 9 beta 5 (XCode 7, beta 6) the following appears when UIActionSheet (or UIAlertController) is displayed: enter image description here

但是,当我在ios9 beta 5 (XCode 7, beta 6)上运行相同的代码时,当显示UIActionSheet(或UIAlertController)时,会出现以下代码:

As you can see, the "Cancel" button does not accept the global tint color. Is this a known issue with iOS 9, or am I missing some code?

如您所见,“取消”按钮不接受全局色调。这是ios9的已知问题,还是我漏掉了一些代码?

2 个解决方案

#1


2  

In iOS 9.0 it seems only changing the window tint helps nothing else seems to work, including the appearanceWhenContainedIn: trick.

在iOS 9.0中,似乎只有改变窗口的颜色才能起作用,包括包含在:trick中的外观。

#2


1  

While using UIAlertController for ActionSheet, make sure to set the tint color after presenting the alert Controller.

在使用UIAlertController用于ActionSheet时,请确保在呈现警告控制器后设置着色颜色。

activityVC = UIActivityViewController(activityItems: objectsToShare, applicationActivities: appActivities)
presentViewController(activityVC!, animated: true, completion: nil)
activityVC?.view.tintColor = UIColor.snapdealBlueColor()

推荐阅读
author-avatar
小豇豆和花椰菜
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有