ios - 更改 UIAlertview 和 UIActionsheet 按钮的色调

标签 ios objective-c cocoa-touch uialertview uiactionsheet

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

我确实添加了

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

给我的应用委托(delegate)

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

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

我怎样才能为所有这些按钮重新着色?

部分截图:

iOS7 message box iOS7 action sheet

最佳答案

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

您可以使用 tintColor 属性。

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.

-来自苹果文档

您可以使用 tintColor 属性,或者您可以为此使用一些自定义库,您可以在 cocoacontrols.com 上找到它。

关于ios - 更改 UIAlertview 和 UIActionsheet 按钮的色调,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19994993/

相关文章:

ios - 有没有更好的方法来计算重复间隔通知的小时代码的顶部?

objective-c - 更改目标的 super View 后检测 TouchesEnded

objective-c - 将标签栏应用程序与导航 Controller 一起使用

ios - UITableView 滚动条没有拉伸(stretch)

ios - Kudan:ARCameraViewController 的内存释放问题

ios - json post 方法 Swift 中出现媒体类型不受支持的错误

java - Objective-C 中的字节数组操作像 Java 一样吗?

ios - UITableView中的多线程

iphone - 在适用于 iOS 的 AdHoc 分发版本上使用沙盒 APNS

objective-c - MKPinAnnotationView 标注未显示