How to make background of UITableViewCell with buttons transparent

有些话、适合烂在心里 提交于 2019-12-07 17:23:20

问题


In IB, on the .xib where the file's owner is a subclass of UITableViewController, the structure of a cell that I wish to load from the xib is:

(UITableViewCell)cell->(UIView)View->(UIButton)but1,but2,but3.

I am trying to have the buttons appear on the table without the frame/background of the cell.

I've made the cell's background and its View's background clearColor, but what I get now is a black background on the cell (with the rounded corners), like so:

Because of the striped nature of the tableview's background, if I choose that same background for the cell then the stripes won't align perfectly, so it is not acceptable. I just need the damn cell to be translucent, I don't know where the black is coming from.

Any ideas?


回答1:


Got it. Thought I'd post it if anybody else is in the same plight:

UIView *backView = [[UIView alloc] initWithFrame:CGRectZero];
backView.backgroundColor = [UIColor clearColor];
cell.backgroundView = backView;
[backView release];

Now it looks like this:



来源:https://stackoverflow.com/questions/3763635/how-to-make-background-of-uitableviewcell-with-buttons-transparent

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!