Created
October 10, 2014 21:01
-
-
Save Tantas/fd4fe78257fc050cd054 to your computer and use it in GitHub Desktop.
iOS7+ Remove UITableView Separator inset
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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