重写UIAlertView(视图背景)



我正在用本教程中看到的类似内容重写UIAlertView类http://mobile.tutsplus.com/tutorials/iphone/ios-sdk-uialertview-custom-graphics/所以我重写了drawRect。

我的问题实际上不是自定义警报本身,而是视图背景色背后的UIAlertView本身现在它是标准的黑色梯度,所有UIAlertViews有…有什么办法吗?

我采取了这种方法,似乎工作…在layoutSubview中,我循环遍历父视图子视图

    for (UIView*superSub in self.superview.subviews) {
    if ([superSub isMemberOfClass:[UIImageView class]]) {
        superSub.backgroundColor = [UIColor colorWithRed:30/255. green:21/255. blue:4/255. alpha:1];
        superSub.alpha = 0.77;
    }
}

最新更新