我正在使用新的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];
现在我想更改标题和消息字体,颜色,大小等.什么是最好的方法呢?
编辑: 我应该插入整个代码.我为UIView创建了一个类别,我可以为iOS版本显示正确的警报.
@implementation UIView (AlertCompatibility)
+( void )showSimpleAlertWithTitle:( NSString * )title
                          message:( NSString * )message
                cancelButtonTitle:( NSString * )cancelButtonTitle
{
    float iOSVersion = [[UIDevice currentDevice].systemVersion floatValue]; …问题类似于iOS 8 UIActivityViewController和UIAlertController按钮文本颜色使用窗口的tintColor但在iOS 9中.
我有一个UIAlertController,即使我试图设置,解除按钮也会保持白色
[[UIView appearanceWhenContainedIn:[UIAlertController class], nil] setTintColor:[UIColor blackColor]];
UIAlertController *strongController = [UIAlertController alertControllerWithTitle:title
                                                             message:message
                                                      preferredStyle:preferredStyle];
strongController.view.tintColor = [UIColor black];
我有一个导航栏,在深色背景颜色上使用白色色调。我用来UIActivityViewController分享 iOS 分享表的链接。
当我选择 WhatsApp 或消息应用程序共享内容时,导航按钮具有默认的蓝色色调。此外,搜索栏(以 WhatsApp 为例)具有灰色色调,这确实使其难以阅读。
我无法更改色调颜色。我的代码:
let textToShare = "Visit my website!"
if let myWebsite = NSURL(string: "http://google.com") {
    let objectsToShare = [textToShare, myWebsite]
    let activityVC = UIActivityViewController(activityItems: objectsToShare, applicationActivities: nil)
    self.presentViewController(activityVC, animated: true, completion: {
        activityVC.navigationController?.navigationBar.tintColor = UIColor.whiteColor()
        activityVC.navigationController?.navigationItem.rightBarButtonItem?.tintColor = UIColor.whiteColor()   
        activityVC.navigationController?.navigationItem.leftBarButtonItem?.tintColor = UIColor.whiteColor()
    })
}
有任何想法吗?
编辑:
这不是重复的问题,因为它与活动视图控制器的按钮色调颜色无关。它与视图控制器的导航控制器的按钮颜色有关,例如按下 iMessage 上的共享后显示的按钮颜色。