剪辑UITableView Cell的分隔符

时间:2010-04-18 22:35:40

标签: iphone uitableview separator scroller

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

Scroller Problem Image

1 个答案:

答案 0 :(得分:1)

您可以在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];  
}