如何在iOS 8中UIAlertController
ActionSheet
设置标题背景颜色?
以下代码是我尝试过的。但我不知道设置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];
}