2012-06-17 134 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

謝謝你的回答 –