相关疑难解决方法(0)

UIAlertController自定义字体,大小,颜色

我正在使用新的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)

objective-c uialertview ios ios8 uialertcontroller

109
推荐指数
13
解决办法
16万
查看次数

在UIAlertView中更改按钮标题颜色

如何更改UIAlertView按钮标题的颜色.

在此输入图像描述

我想要Ok红色标题.

iphone objective-c uialertview ios

9
推荐指数
4
解决办法
2万
查看次数

更改UIAlertview和UIActionsheet按钮的色调颜色

我正在尝试为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)

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

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

一些截图:

iOS7留言框 iOS7操作表

cocoa-touch objective-c uialertview uiactionsheet ios

8
推荐指数
3
解决办法
2万
查看次数