Skip to content

Instantly share code, notes, and snippets.

@Tantas
Created October 10, 2014 21:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Tantas/fd4fe78257fc050cd054 to your computer and use it in GitHub Desktop.
Save Tantas/fd4fe78257fc050cd054 to your computer and use it in GitHub Desktop.
iOS7+ Remove UITableView Separator inset
// Place in implementation of UITableViewDelegate
#pragma mark - Remove Seperator Inset
// Refer to http://stackoverflow.com/questions/25770119/ios-8-uitableview-separator-inset-0-not-working#answer-25877725
- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath
{
if ([cell respondsToSelector:@selector(setSeparatorInset:)]) {
[cell setSeparatorInset:UIEdgeInsetsZero];
}
if ([cell respondsToSelector:@selector(setLayoutMargins:)]) {
[cell setLayoutMargins:UIEdgeInsetsZero];
}
}
- (void)viewDidLayoutSubviews
{
if ([self.tableView respondsToSelector:@selector(setSeparatorInset:)]) {
[self.tableView setSeparatorInset:UIEdgeInsetsZero];
}
if ([self.tableView respondsToSelector:@selector(setLayoutMargins:)]) {
[self.tableView setLayoutMargins:UIEdgeInsetsZero];
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment