2012-03-09 170 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