我怎样才能拥有一个完全透明的UIAlertView? [英] how can I have a totally transparent UIAlertView?

查看:67
本文介绍了我怎样才能拥有一个完全透明的UIAlertView?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要一个UIALertView,它在弹出时应该足够透明,以便以褪色的方式显示在Alertview后面的背景,并且不应显示警报视图的蓝色,因为该警报视图后面的背景是黑色和灰色.颜色.在链接中可以看到更改颜色并将图像放置到警报视图中的一件事: iOS 5个黑色透明UIAlertView 更改UIAlertView的背景颜色?
但我需要一个透明的UIAlertView.可以买一个吗?如果可以,怎么办? 感谢您的提前帮助.

I need a UIALertView, which on popping up should be transparent enough to show the background behind the alertview in a faded way and the blue color of the alert view should not appear since the background behind the alert view is black and grey in color. Changing color and putting an image to the alert view is one thing which can be seen in the links : iOS 5 black transparent UIAlertView and Changing the background color of a UIAlertView?
but I need a transparent UIAlertView. Is it possible to get one?If yes how? Thanks for the help in advance.

推荐答案

如果您查看

If you look at Apple's documentation page for UIAlertView you'll see this note:

UIAlertView类旨在按原样使用,而不是按原样使用 支持子类化. 此类的视图层次结构是私有的, 不得修改.

The UIAlertView class is intended to be used as-is and does not support subclassing. The view hierarchy for this class is private and must not be modified.

换句话说,在UIAlertView方面,苹果公司不希望开发人员为颜色,字体或背景而烦恼.如果Apple在以后的iOS中更改了UIAlertView的内部功能,则在显示修改后的警报时,您的应用可能会产生意想不到的效果.

In other words, Apple doesn't want developers to muck around with colors or fonts or backgrounds when it comes to UIAlertView. If Apple changes the internal guts of UIAlertView in a later iOS, your app is likely to have unexpected and not-desired effects when that modified alert appears.

如果您想要类似UIAlertView的自定义UIAlertView行为,为什么不编写自己的外观和行为类似于UIAlertView的UIView .然后,您可以完全控制其绘制方式.

If you want custom UIAlertView like behavior, why not just write your own UIView that looks and behaves a lot like UIAlertView. And then you have full control over everything about how it's drawn.

这篇关于我怎样才能拥有一个完全透明的UIAlertView?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆