有没有办法自定义UITableView的分隔线图形?

发布于 2024-08-18 15:32:40 字数 114 浏览 2 评论 0原文

我正在寻找自定义 UITableView 的分隔线图形。 它基本上是一条线,并且可以隐藏。但我不知道如何用我自己的自定义图形或图像绘制分隔符。有常规方法可以做到这一点吗? 或者我必须自己绘制所有内容并手动管理它们?

I'm finding customizing UITableView's separator line graphics.
It's basically a single line and it can be hidden. But I cannot know how to draw separator with my own custom graphics or image. Is there a regular way to do this?
Or do I have to draw all myself and manage them manually?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

安静 2024-08-25 15:32:40

一种简单的方法是隐藏分隔符并将您自己的分隔符嵌入单元格的背景图像中。


如果需要绘制自己的分隔符,则需要重写 -[UITableView _drawExtraSeparator:]-[UITableViewCell _drawSeparatorInRect:]-[_UITableViewSeparatorView drawRect:]。这些都是未记录的,所以不要考虑在AppStore中使用它们。

A simple way is hide the separator and embed your own separator in the cell's background image.


If you need to draw your own separator, you need to override -[UITableView _drawExtraSeparator:] or -[UITableViewCell _drawSeparatorInRect:] or -[_UITableViewSeparatorView drawRect:]. These are all undocumented so don't think about using them in the AppStore.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文