如何在iPhone中自定义tableView分隔符 [英] How to customize tableView separator in iPhone
问题描述
默认情况下,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:
- 创建自定义 UITableViewCell ,其中包含您的自定义分隔符
- 创建备用 UITableViewCell 包含您的自定义分隔符
- create custom UITableViewCells that include your custom seperator within them
- create alternate UITableViewCells 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.
参见在 perience / Conceptual / TableView_iPhone / Introduction / Introduction.htmlrel =noreferrer>表视图编程指南,了解有关如何创建自定义 UITableViewCell s。
See Subclassing UITableViewCell in the Table View Programming Guide for more information on how to create custom UITableViewCells.
这篇关于如何在iPhone中自定义tableView分隔符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!