How to customize UITableView separator when the cells got a custom height <p>I followed this post: <a href="http://stackoverflow.com/questions/1374990/how-to-customize-tableview-separator-in-iphone">How to customize tableView separator in iPhone</a></p> <p>Problem is that it doesn't work well when I have custom height for my cell.</p> <p>I'll show you with two images, the one with two lines is the result of having a custom height for my cells.</p> <p><img src="https://i.stack.imgur.com/VzWI6.png" alt="enter image description here"></p> <p>With custom height: <img src="https://i.stack.imgur.com/cxc9d.png" alt="enter image description here"></p> <pre><code>- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { UIView *lineView = [[UIView alloc] initWithFrame:CGRectMake(0, cell.contentView.frame.size.height - 1.0, cell.contentView.frame.size.width, 1)]; lineView.backgroundColor = [UIColor darkGrayColor]; [cell.contentView addSubview:lineView]; } - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { return 50; } </code></pre>