Reputation: 720
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!
Upvotes: 4
Views: 5201
Reputation: 4111
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:)
Upvotes: 10
Reputation: 799
I think there is no separator as a dotted line. You could create own separator by appending image to the end of custom cell.
Upvotes: 1