Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UITableView Cells separated by dotted lines

I'd like to change the separator from a UITableView to a dotted line. All I could find is UITableViewCellSeparatorStyleBlabla...

Can I put something else instead? I'd rather not use images, but if there is no other way...

Thanks!

like image 987
Fervus Avatar asked Dec 21 '22 22:12

Fervus


1 Answers

Try the solutions below:

self.tableView.separatorColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"Dottedlineimage"]];   

note:Don't forget to turn off the default separator style for the table view in both the solutions: [self.tableView setSeparatorStyle:UITableViewCellSeparatorStyleNone];

=====================OR TRY THIS===========================================

UIImageView *aLine = [[UIImageView alloc] initWithFrame:CGRectMake(cell.frame.origin.x, cell.frame.origin.y, cell.frame.size.width, cell.frame.size.height)];
 [aLine setImage:[UIImage imageNamed:@"yourDottedImage.png"]];
 [cell.contentView addSubview:aLine];
 [aLine release];  

H appy to help:)

like image 90
maddy Avatar answered Jan 05 '23 01:01

maddy