Skip to content

Instantly share code, notes, and snippets.

@mamaz
Created December 27, 2014 08:40
Show Gist options
  • Save mamaz/d7cd00d00549f74454f4 to your computer and use it in GitHub Desktop.
Save mamaz/d7cd00d00549f74454f4 to your computer and use it in GitHub Desktop.
Make table separator without any indent
// iOS 7+
// on custom cell
- (void)awakeFromNib // or layoutSubviews
{
// make table separator without any indent
if ([self respondsToSelector:@selector(setLayoutMargins:)]) {
self.layoutMargins = UIEdgeInsetsZero;
}
if ([self respondsToSelector:@selector(setPreservesSuperviewLayoutMargins:)]) {
self.preservesSuperviewLayoutMargins = NO;
}
}
// on ViewController
- (void)viewDidLoad
{
[super viewDidLoad];
if ([self.tableView respondsToSelector:@selector(setSeparatorInset:)]) {
[self.tableView setSeparatorInset:UIEdgeInsetsMake(0, 0, 0, 0)];
}
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