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

时间:2014-07-22 09:26:14

标签: ios7

我想在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];

}

3 个答案:

答案 0 :(得分:0)

根据我的经验,您无法自定义查看UIAlertView 您可以在iOS7及更高版本中选择this解决方案。

答案 1 :(得分:0)

  • 不,您无法自定义UIAlertView。

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

  • 您可以查看此link。它可能对你有帮助!

答案 2 :(得分:0)

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

alert.inputView.backgroundColor = [UIColor redColor];

如果您需要更改整个警报视图颜色,则意味着您可以添加自定义警报视图。 谢谢。