1

如何在 iOS 8中设置标题背景颜色UIAlertControllerActionSheet

以下代码是我尝试过的。但我不知道设置标题颜色ActionSheet

- (IBAction)bt2Clicked:(UIButton *)sender {

// Action sheet style.
   UIAlertController *actionSheet = [UIAlertController alertControllerWithTitle:@"Evacuate Building!" message:@"" preferredStyle:UIAlertControllerStyleActionSheet];

__weak ViewController *wself = self;

UIAlertAction *destructiveAction = [UIAlertAction actionWithTitle:@"Kick through door" style:UIAlertActionStyleDestructive handler:^(UIAlertAction *action) {
    __strong ViewController *sself = wself;
    sself.actionResponseLabel.text = @"Careful!";
}];

UIAlertAction *defaultAction = [UIAlertAction actionWithTitle:@"Walk calmly" style:UIAlertActionStyleCancel handler:^(UIAlertAction *action) {
    __strong ViewController *sself = wself;
    sself.actionResponseLabel.text = @"Find nearest exit.";
}];

UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:@"Do nothing" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
    __strong ViewController *sself = wself;
    sself.actionResponseLabel.text = @"Just relax";
}];


[actionSheet addAction:destructiveAction];
[actionSheet addAction:defaultAction];
[actionSheet addAction:cancelAction];
actionSheet.view.tintColor = [UIColor blackColor];

UIColor *customTitleColor=[UIColor colorWithRed:(0.0/255.0) green:(159.0/255.0) blue:(196.0/255.0) alpha:1.0];         //  **I need to set this colour to title.** 

[self presentViewController:actionSheet animated:YES completion:nil];  

}
4

0 回答 0