UITableView单面边框颜色?

Aka*_*tra 1 iphone border colors uitableview ios

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

示例图片http://i40.tinypic.com/14kgvbk.jpg

有任何想法吗?

El *_*per 5

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

- (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;
}
Run Code Online (Sandbox Code Playgroud)