2013-05-09 75 views
0

我有一个UITableViewCell的子类,我需要为单元绘制一个自定义的backgroundView。实现drawRect:,我可以很好地绘制视图,但它是在tableView和tableViewCells后面。使用CoreGraphics绘制UITableViewCell backgroundView

为了使用CG绘制我的自定义backgroundView,我是否需要制作一个单独的UIView子类,然后将其绘制为单元格的backgroundView?

谢谢!

编辑:截图

我想可以得出,而不是白色的蓝。代替白色。或者至少在它之上。 enter image description here

我在使用CA的单元格后面绘制阴影,并且我希望在我绘制的视图背后留下这个阴影。

+0

显示的截图,所以我们可以看到发生了什么。 – 2013-05-09 19:20:25

回答

0

您需要设置contentView的背景。

myCell.contentView.backgroundColor = [ UIColor greenColor ]; // 
0

试试这个,

cell.contentView.backgroundColor = [UIColor clearColor]; 
相关问题