2012-03-09 183 views
2

我有一個問題,定製我的AQGridViewCell。我想有具有透明背景的全細胞,但initWithFrame以下內:reuseIdentifier不會做的工作:AQGridViewCell透明背景

self.backgroundView.backgroundColor = [UIColor clearColor]; 
self.contentView.backgroundColor = [UIColor clearColor]; 
self.backgroundColor = [UIColor clearColor]; 

self.backgroundView.opaque = NO; 
self.contentView.opaque = NO; 
self.opaque = NO; 

有沒有人有一個想法如何解決這個問題?

非常感謝您的回覆!

編輯 我發現this,但是這似乎並沒有工作,要麼: https://github.com/AlanQuatermain/AQGridView/pull/108#issuecomment-3610006

回答

6

尖端在link了一半,在那裏。下面的伎倆對我來說:

self.contentView.backgroundColor = nil; 
self.backgroundColor = nil; 

而且你需要把這個在您的自定義AQGridViewCell的initWithFrame:reuseIdentifier:。有一點令你費解,你必須設置兩個屬性,但至少可以工作。

另外請注意,您還需要將背景色設置爲clear所有你可能有文本標籤,e.g:

captionLabel.backgroundColor = [UIColor clearColor]; 

設置標籤背景nil沒有幫助 - 它出來爲黑色。

+0

非常感謝!這兩個屬性做到了!標籤已被設置爲清除,但無論如何感謝:) – 2012-03-17 15:27:09