Clip UITableView Cell's Separator
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
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];
}
精彩评论