2012-06-17 136 views
9

我想将我的UItextview的颜色设置为透明但不完全透明。我想有点灰色或黑色的背景完全一样的图片UItextview透明颜色IOS

enter image description here

我使用此代码现在

_textView.backgroundColor = [UIColor clearColor]; 

我怎样才能使它透明如上面的图片?任何示例代码?

回答

5

你应该使用这样的事情:

_textView.backgroundColor = [UIColor colorWithRed:1.0 green:1.0 blue:1.0 alpha:0.5]; 

其中alpha - 参数为透明(例如50%)。

4

这是做你想做的吗? (您可能需要试验这些值)。

_textView.backgroundColor = [UIColor colorWithWhite:0.5 alpha:0.5]; 
+0

谢谢你的回答 –