简体   繁体   English

如何制作透明的tableview?

[英]How to make a transparent tableview?

im trying to make a menu like FIFA app but i can't put the tableview in a transparent color,so the background image can be visible, can anyone help me?? 我试图制作像FIFA应用程序这样的菜单,但是我不能将tableview设置为透明颜色,因此背景图像可以看到,有人可以帮助我吗? I've tried of everything, any of this answers worked for me: UITableView clear background so i really need your help. 我已经尝试了所有方法,以下任何答案都对我有用: UITableView背景清晰,因此我真的需要您的帮助。

In addition to setting the background color of the table view to clear, you have to set the background color of the table view cells . 除了将表格视图的背景色设置为清除之外,还必须设置表格视图单元格的背景色。 And that, at least in my experience, has been somewhat tricky and couldn't be easily done via Interface Builder (the storyboard or the xib). 而且,至少以我的经验来看,这有些棘手,并且无法通过Interface Builder(情节提要或xib)轻松完成。

So you have to set the background color on your cells directly. 因此,您必须直接在单元格上设置背景色。 For example, during your tableView:willDisplayCell:forRowAtIndexPath: delegate method, you'd do something like: 例如,在tableView:willDisplayCell:forRowAtIndexPath:委托方法期间,您将执行以下操作:

cell.backgroundColor = [UIColor clearColor];

And as rmaddy points out, Apple documentation for that method states: 就像rmaddy指出的那样,该方法的Apple文档指出:

This method gives the delegate a chance to override state-based properties set earlier by the table view, such as selection and background color. 此方法使代理有机会覆盖表视图先前设置的基于状态的属性,例如选择和背景颜色。

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

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