Skip to content

Instantly share code, notes, and snippets.

@liruqi liruqi/NSPZeroMarginCell.m
Last active Feb 23, 2016

What would you like to do?
Zero content margin UITableViewCell
// Hide separator for specific cell is extremely hard in iOS 9.
// None of these worked or good enough for me:
@interface NSPZeroMarginCell : UITableViewCell
@property (nonatomic, assign) BOOL separatorHidden;
@implementation NSPZeroMarginCell
- (void) layoutSubviews {
[super layoutSubviews];
CGRect f = self.textLabel.frame;
f.origin.x = 0;
self.textLabel.frame = f;
for (UIView *view in self.subviews) {
if (![view isKindOfClass:[UIControl class]]) {
if (CGRectGetHeight(view.frame) < 3) {
view.hidden = self.separatorHidden;

This comment has been minimized.

Copy link

jrejaud commented Feb 23, 2016

Works great on iOS 9 :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.