简体   繁体   English

在uitableview上添加整理器

[英]add finishing separator on uitableview

I have a custom separator style (fairly simple): 我有一个自定义的分隔符样式(非常简单):

[[UITableView appearance] setSeparatorColor:SOMECOLOR];

Now I want to have my tableview finish with a separator. 现在,我想用分隔符完成tableview。 Currently separators only appear between two cells, but I want to have a separator at the end. 当前,分隔符仅出现在两个单元格之间,但我想在末尾使用分隔符。

see here: 看这里:

没有分隔符出现

any ideas how this could be done? 任何想法如何做到这一点?

I usually make my own separator inside the table view cell. 我通常在表格视图单元格内创建自己的分隔符。 I do this with a UIView that spans the width of the cell and is 1 or 2 points high. 我使用横跨单元格宽度且高度为1或2点的UIView进行此操作。

In your case, if you want the system separator, you would have to add a custom cell at the end which is all transparent and 1 point high. 对于您的情况,如果要使用系统分隔符,则必须在末尾添加一个自定义单元格,该单元格必须透明且高1点。 UITableView would then add the missing separator. 然后,UITableView将添加缺少的分隔符。

I understand it you want a separator at the end as well? 我知道您还需要分隔符吗? You can add a footer view to achieve this effect. 您可以添加页脚视图以实现此效果。

Make a footer view with height of 0.0001. 制作高度为0.0001的页脚视图。 To do so simply implement the following tableview delegate method : 为此,只需实现以下tableview委托方法:

-(CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{ return 0.001; }

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

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