我正在使用新的UIAlertController来显示警报.我有这个代码:
// nil titles break alert interface on iOS 8.0, so we'll be using empty strings
UIAlertController *alert = [UIAlertController alertControllerWithTitle: title == nil ? @"": title message: message preferredStyle: UIAlertControllerStyleAlert];
UIAlertAction *defaultAction = [UIAlertAction actionWithTitle: cancelButtonTitle style: UIAlertActionStyleCancel handler: nil];
[alert addAction: defaultAction];
UIViewController *rootViewController = [UIApplication sharedApplication].keyWindow.rootViewController;
[rootViewController presentViewController:alert animated:YES completion:nil];
Run Code Online (Sandbox Code Playgroud)
现在我想更改标题和消息字体,颜色,大小等.什么是最好的方法呢?
编辑: 我应该插入整个代码.我为UIView创建了一个类别,我可以为iOS版本显示正确的警报.
@implementation UIView (AlertCompatibility)
+( void )showSimpleAlertWithTitle:( NSString * )title
message:( NSString * )message
cancelButtonTitle:( NSString * )cancelButtonTitle
{
float iOSVersion = [[UIDevice currentDevice].systemVersion floatValue]; …Run Code Online (Sandbox Code Playgroud) 如何更改UIAlertView按钮标题的颜色.

我想要Ok红色标题.
我正在尝试为iOS 7调整我的应用程序.我遇到的问题是我无法更改某些控件的色调颜色.
我添加了
self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];
if (IOS7_OR_LATER)
self.window.tintColor = [self greenTintColor];
Run Code Online (Sandbox Code Playgroud)
到我的应用代表的
- (BOOL)application:(UIApplication *)application
didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
Run Code Online (Sandbox Code Playgroud)
它主要有所帮助,但消息框和操作表按钮的颜色仍然是默认的蓝色.
我怎样才能重新着色所有这些按钮呢?
一些截图:
