Last active
November 6, 2017 01:59
-
-
Save brandons/c96f8aa9013c9c088150c7c436bfa452 to your computer and use it in GitHub Desktop.
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
// | |
// UITableView+HideSeparators.h | |
// | |
// Created by Brandon Schlenker on 11/5/17. | |
// Copyright © 2017 Brandon Schlenker. All rights reserved. | |
// | |
#import <UIKit/UIKit.h> | |
@interface UITableView (HideSeparators) | |
- (void)bs_hideSeparatorForRowAtIndexPath:(NSIndexPath *)indexPath; | |
@end |
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
// | |
// UITableView+HideSeparators.m | |
// | |
// Created by Brandon Schlenker on 11/5/17. | |
// Copyright © 2017 Brandon Schlenker. All rights reserved. | |
// | |
#import "UITableView+HideSeparators.h" | |
#import <objc/runtime.h> | |
@implementation UITableView (HideSeparators) | |
+ (void)load { | |
static dispatch_once_t onceToken; | |
dispatch_once(&onceToken, ^{ | |
Class class = [self class]; | |
Method originalMethod = class_getInstanceMethod(class, NSSelectorFromString(@"_hideSeparatorForRowAtIndexPath:")); | |
Method swizzledMethod = class_getInstanceMethod(class, @selector(bs_hideSeparatorForRowAtIndexPath:)); | |
method_exchangeImplementations(originalMethod, swizzledMethod); | |
}); | |
} | |
- (void)bs_hideSeparatorForRowAtIndexPath:(NSIndexPath *)indexPath { | |
[self bs_hideSeparatorForRowAtIndexPath:indexPath]; | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment