更改UIAlertview和UIActionsheet按钮的色调颜色 [英] Change tint color of UIAlertview and UIActionsheet buttons

查看:248
本文介绍了更改UIAlertview和UIActionsheet按钮的色调颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试为iOS 7调整我的应用程序。我遇到的问题是我无法更改某些控件的色调颜色。

I am trying to adapt my application for iOS 7. The issue I am having is I can not change the tint color of some controls.

我添加了

self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];
if (IOS7_OR_LATER)
    self.window.tintColor = [self greenTintColor];

到我的应用代表的

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

它主要有所帮助,但消息框和操作表按钮的颜色仍然是默认的蓝色。

It mostly helped but color of message box and action sheet buttons is still the default blue.

我如何重新着色所有这些按钮?

一些截图:


推荐答案

作为 UIAlertView 已弃用您可以。使用 UIAlertController

As UIAlertView is deprecated You can. Use UIAlertController.

您可以使用 tintColor 属性。

You can use tintColor property.

OLD


UIAlertView类旨在按原样使用,而不是
支持子类化。此类的视图层次结构是私有的,并且不得修改

The UIAlertView class is intended to be used as-is and does not support subclassing. The view hierarchy for this class is private and must not be modified.

- 来自Apple Doc

-From Apple Doc

您可以使用 tintColor 属性或您可以使用某些自定义库,您可以在cocoacontrols.com找到它。

You can use tintColor property or You can use Some Custom Library for that, you can find it at cocoacontrols.com.

这篇关于更改UIAlertview和UIActionsheet按钮的色调颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆