I\'d like to have a tableview border styled like this one,only the left side is colored.
Any ideas?
The easiest way I can think of is to add a little view in the content view:
- (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;
}
A simple way would be to add a UIImageView
to your cells that has a small width and the same height with the cell (example). Another approach would be to use an image as a background for each cell, and add this border in the actual graphic that you will use (example). And if you want to make it in a layer level, a good start is this example. I hope that helps!