简体   繁体   English

如何在IOS7中使UITableView透明?

[英]How to make UITableView transparent in IOS7?

I have tried many times and many method to UITableView transparent in IOS7,but it still does not work.I have no any ideas... 我在IOS7中尝试了很多次和UITableView透明的很多方法,但它仍然不起作用。我没有任何想法......

"[cell setBackgroundColor:[UIColor clearColor]];"


UIView* bgv = [[UIView alloc] init];
bgv.backgroundColor = [UIColor clearColor];
[cell setBackgroundColor:[UIColor clearColor]];
[cell setBackgroundView:bgv];

cell.backgroundColor = [UIColor colorWithRed:(247.0/255.0)
                                 green:(151.0/255.0)  blue:(121.0/255.0) alpha:.3];

All over these 3 method I've tried,still not work. 我试过这3种方法,但仍然无效。

Can anybody give some more tips about this problem? 有人可以提供一些关于这个问题的提示吗?

Thanks a lot~ 非常感谢〜

Use this 用这个

cell.contentView.backgroundColor = [UIColor clearColor];
        cell.backgroundColor = [UIColor clearColor];
        tableView.backgroundColor = [UIColor clearColor];

您需要将tableView的背景设置为清除颜色,您需要对表视图的引用。

You have to just clear your TableView cell color. 您只需清除TableView单元格颜色即可。 And select tableview background color from property list. 并从属性列表中选择tableview背景颜色。 Or set tblobj.backgroundcolor... 或者设置tblobj.backgroundcolor ...

cell.backgroundColor = [UIColor clearColor];
cell.contentView.backgroundColor = [UIColor clearColor];

set table view background color clear and backgound view nil 设置表视图背景颜色清楚和backgound视图零

[tableView setBackgroundColor:[UIColor clearColor]];
[tableView setBackgroundView:nil];

set cell background color as clear color and cell contentview background color as clear 设置单元格背景颜色为清晰颜色,单元格内容视图背景颜色为清晰

[cell setBackgroundColor:[UIColor clearColor]];
[cell.contentView setBackgroundColor:[UIColor clearColor]];

This will gives you transparent tableView 这将为您提供透明的tableView

For me, setting the TableViewController class backgroundColor to clearColor programmatically did the trick. 对我来说,以编程方式将TableViewControllerbackgroundColor设置为clearColor就可以了。

You just need to make sure every single object with a background should have the transparent color. 您只需要确保每个具有背景的对象都应该具有透明色。 And while I set all of them to transparent in the interface builder, it apparently doesn't always take. 虽然我在界面构建器中将它们全部设置为透明,但显然并不总是如此。

除了设置表格视图背景颜色以清除颜色外,还需要设置cell.contentview背景颜色以清除颜色

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM