如何在 iPhone 中自定义 tableView 分隔符 [英] How to customize tableView separator in iPhone

查看:27
本文介绍了如何在 iPhone 中自定义 tableView 分隔符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

默认情况下,uitableview 中有一个单行分隔符.

By default there is a single line separator in uitableview.

但我想把我的自定义行作为分隔符.

But I want to put my customized line as a separator.

有可能吗?怎么样?

推荐答案

如果您想做的不仅仅是使用 separatorColor 属性 UITableView 然后你可以设置 separatorStyle 属性为 UITableViewCellSeparatorStyleNone 和要么:

If you want to do more than change the color of the separator using the separatorColor property of the UITableView then you could set the separatorStyle property to UITableViewCellSeparatorStyleNone and then either:

  • 创建自定义UITableViewCells 在其中包含您的自定义分隔符
  • 创建包含自定义分隔符的备用 [UITableViewCell][6]
  • create custom UITableViewCells that include your custom seperator within them
  • create alternate [UITableViewCell][6]s that include your custom separator

例如,如果您的表格当前显示 5 行,您可以将其更新为显示 9 行,索引 1、3、5、7 处的行将是分隔单元格.

For example, if your table currently displays 5 rows you could update it to display 9 rows and the rows at index 1, 3, 5, 7 would be separator cells.

这篇关于如何在 iPhone 中自定义 tableView 分隔符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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