Created
December 27, 2014 08:40
-
-
Save mamaz/d7cd00d00549f74454f4 to your computer and use it in GitHub Desktop.
Make table separator without any indent
This file contains hidden or 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
// 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