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;
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];
As I know, you can't add border for one side of UITableView only. Check this answer here, it could help you
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.