剪辑 UITableView 单元格的分隔符

发布于 2024-08-29 12:01:13 字数 306 浏览 2 评论 0原文

我一直在尝试构建一个看起来类似于“股票”应用程序的视图(惊喜)。我想要的是将滚动条放在圆桌视图之外,如下面的图像链接所示,但剪掉单元格分隔符。您可以看到它们如何与滚动条重叠,这很烦人。我不明白苹果是如何将滚动条放在看起来像是在桌子外面的位置的。有什么想法吗? (抱歉,还无法嵌入图像,因为我是新用户)。

滚动条问题图片

I've been trying to build a view that looks similar to the "stocks" application (surprise). What I would like is to have the scroller bar outside of my rounded table view, shown in the image link below, but clip the cell separators. You can see how they overlap the scroller bar, which is annoying. I can't figure out how Apple put the scroller bar in a spot that looks like it is outside their table. Any ideas? (sorry, can't imbed images yet because I'm a new user).

Scroller Problem Image

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

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

发布评论

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

评论(1

趁年轻赶紧闹 2024-09-05 12:01:13

您可以在 UITableViewCell 的 drawRect 方法中绘制自己的分隔符:

- (void)drawRect:(CGRect)rect {
    CGContextRef ctx = UIGraphicsGetCurrentContext();

    CGContextSetRGBStrokeColor(ctx, 1.0f, 1.0f, 1.0f, 1.0f);
    CGContextSetLineWidth(ctx, 1.0f);

    CGContextMoveToPoint(ctx, 0, self.bounds.size.height);
    CGContextAddLineToPoint(ctx, self.bounds.size.width - 20, self.bounds.size.height);

    CGContextStrokePath(ctx);
    [super drawRect:rect];  
}

You may draw your own separators in drawRect method of UITableViewCell:

- (void)drawRect:(CGRect)rect {
    CGContextRef ctx = UIGraphicsGetCurrentContext();

    CGContextSetRGBStrokeColor(ctx, 1.0f, 1.0f, 1.0f, 1.0f);
    CGContextSetLineWidth(ctx, 1.0f);

    CGContextMoveToPoint(ctx, 0, self.bounds.size.height);
    CGContextAddLineToPoint(ctx, self.bounds.size.width - 20, self.bounds.size.height);

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