Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/305.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在ios7中更改UIAlertView背景颜色或背景图像?_Ios7 - Fatal编程技术网

如何在ios7中更改UIAlertView背景颜色或背景图像?

如何在ios7中更改UIAlertView背景颜色或背景图像?,ios7,Ios7,我想定制iOS7中的UIAlertView背景色。 有谁能给出正确的解决方案吗? 以下是我的代码 void UIAlertViewQuick(NSString* title, NSString* message, NSString* dismissButtonTitle) { UIAlertView* alert = [[UIAlertView alloc] initWithTitle:title

我想定制iOS7中的
UIAlertView
背景色。 有谁能给出正确的解决方案吗? 以下是我的代码

void UIAlertViewQuick(NSString* title, NSString* message, NSString* dismissButtonTitle) {
    UIAlertView* alert = [[UIAlertView alloc] initWithTitle:title
                                                    message:message
                                                   delegate:nil 
                                          cancelButtonTitle:dismissButtonTitle
                                          otherButtonTitles:nil
                          ];


    [alert show];

}

根据我的经验,您无法自定义
UIAlertView

您可以在iOS7及更高版本中选择解决方案。

  • 不,您不能自定义UIAlertView

  • 因此,如果必须这样做,可以使用提供类似UIAlertView显示的UIView来完成。您可以使用按钮创建自定义视图,并在整个应用程序中使用它

  • 你可以检查一下。它可能会帮助你


我们无法更改整个UIAlertview背景色,我们只能使用以下代码更改inputView颜色

alert.inputView.backgroundColor=[UIColor redColor]

如果需要更改整个警报视图的颜色,则表示可以添加自定义警报视图。
谢谢。

Hi raja,感谢您的回复。我们可以将UIView添加到UIAlertView附件中,以执行上述操作,无需转到第三方。