Reputation: 15015
I wanted to set only right border in UITableView?
So far i have tried this below code. But it is setting the border in whole table as it is there in mac, But i wanted to achieve that it should set only right border :-
self.tableView.layer.borderWidth = 1.0;
Upvotes: 1
Views: 5503
Reputation: 6079
instead of using layer you can add a view to the contentView of the cell the size you want, this add border of 1px:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
...
UIView *right = [[UIView alloc] initWithFrame:CGRectMake(319, 0, 1, cell.frame.size.height)];
right.backgroundColor = [UIColor redColor];
[cell.contentView addSubview:right];
Upvotes: 5
Reputation: 1114
As I know, you can't add border for one side of UITableView only. Check this answer here, it could help you
UITableView one sided Border color?
Upvotes: 2