Ios 更改UIAlertController的背景色
我的代码是Ios 更改UIAlertController的背景色,ios,objective-c,iphone,background,uialertcontroller,Ios,Objective C,Iphone,Background,Uialertcontroller,我的代码是 UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"Touch ID for Eceipt" message:@"Touch ID or Enter Password" preferredStyle:UIAlertControllerStyleAlert]; UIAlertAction *cancelButt
UIAlertController *alert = [UIAlertController
alertControllerWithTitle:@"Touch ID for Eceipt" message:@"Touch ID or Enter Password" preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction *cancelButton = [UIAlertAction
actionWithTitle:@"Cancel"
style:UIAlertActionStyleDefault
handler:^(UIAlertAction * action) {
//Handle your yes please button action here
}];
alert.view.tintColor=[UIColor blueColor];
alert.view.backgroundColor=[UIColor whiteColor]; //this code changes the alert view color
alert.view.layer.cornerRadius=10;
[alert addAction:cancelButton];
[self presentViewController:alert animated:YES completion:nil];
通过这段代码,我可以实现“蓝色取消按钮”和白色警报视图以及灰色背景
我需要的是更多的深色背景。
这是我的输出截图
我需要这样的背景截图@Anbu.Karthik Narendra Pandey->尝试过,但结果是,它改变了ALTER CONTENTVIEW的颜色。它不会改变Alertcontentview的背景。请参阅:@Anbu.Karthik Narendra Pandey->尝试过,但结果是,它会更改ALTER CONTENTVIEW颜色。它不会更改Alertcontentview的背景。请参阅: