从分组样式UITableView的一部分中删除单元格边框 [英] Removing cell borders from a section of grouped-style UITableView
问题描述
我有一个UITableViewController初始化与分组的风格和有多个部分。对于这些部分中的一个,我想它的组成单元格是完全透明的,没有边框。我计划为这个部分中的每一行分配一个自定义视图,但是被分组的表单元格包围的自定义视图看起来不好:(
I have a UITableViewController initialized with the grouped style and having multiple sections. For one of these sections, I'd like its constituent cells to be completely transparent and have no border. I plan to assign a custom view for every row in this section, but having that custom view surrounded by the grouped table cell looks bad :(
以下使背景颜色的细胞黑色而不是透明...我仍然不知道如何摆脱边界。
The following makes the background color of a cell black instead of transparent... And I still don't know how to get rid of the border.
cell.backgroundColor = [UIColor clearColor];
任何指针?
推荐答案
注意:这在iOS7及以上版本中不起作用。对于iOS7,请尝试此回答。
NOTE: This doesn't appear to be working in iOS7 and above. For iOS7 try this answer.
对于iOS6及以下版本,要从分组的单元格中删除分组的背景表视图单元格:
For iOS6 and below, to remove the grouped background from a cell in a grouped table view cell:
此操作无效
cell.backgroundView = nil; // Did Not Work
cell.backgroundView = [[[UIView alloc] initWithFrame:CGRectZero] autorelease];
如果您已移至ARC 但尚未测试)
cell.backgroundView = [UIView new];
这篇关于从分组样式UITableView的一部分中删除单元格边框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!