UITableViewCell之间的差距 [英] gap between UITableViewCell

查看:56
本文介绍了UITableViewCell之间的差距的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要在 UITableViewCell 之间留一点空隙,有没有办法实现这一目标?

I need to place small gap between UITableViewCell, is there way that I can achieve this?

推荐答案

UITableView 中,您具有2个属性: separatorStyle separatorColor ,但是也许这对您来说还不够.

In UITableView you have 2 properties : separatorStyle and separatorColor, but maybe it is not enough for you.

然后,您需要自己实现它们:例如,如果您的TableView具有12个单元格,则可以使用12 * 2-1个单元格(-1,因为我们不需要第一个单元格分隔符),其中奇数(从0开始)将是您的自定义分隔符,具有自定义高度,颜色或图像,但您必须自己做.

Then you need to implement them by yourself : If your TableView has for example 12 cells you can use 12*2-1 cells (-1 because we don't need separator for the first cell) where odd number (starting from 0) will be your custom separator, with custom height, color or images like you would like but you have to do that by yourself.

0 => cell
1 => Separator
2 => cell
3 => Separator
4 => cell
...

我希望这会对您有所帮助.

I hope this will help you.

这篇关于UITableViewCell之间的差距的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆