Skip to content

Instantly share code, notes, and snippets.

@fcaldarelli
Last active August 29, 2015 14:23
Show Gist options
  • Save fcaldarelli/ee769816bc80fd3b8216 to your computer and use it in GitHub Desktop.
Save fcaldarelli/ee769816bc80fd3b8216 to your computer and use it in GitHub Desktop.
UITableViewCell full width
#import <UIKit/UIKit.h>
@interface FullWidthTableViewCell : UITableViewCell
@end
#import "FullWidthTableViewCell.h"
@implementation FullWidthTableViewCell
- (void)awakeFromNib {
// Initialization code
// Remove seperator inset
if ([self respondsToSelector:@selector(setSeparatorInset:)]) {
[self setSeparatorInset:UIEdgeInsetsZero];
}
// Prevent the cell from inheriting the Table View's margin settings
if ([self respondsToSelector:@selector(setPreservesSuperviewLayoutMargins:)]) {
[self setPreservesSuperviewLayoutMargins:NO];
}
// Explictly set your cell's layout margins
if ([self respondsToSelector:@selector(setLayoutMargins:)]) {
[self setLayoutMargins:UIEdgeInsetsZero];
}
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
[super setSelected:selected animated:animated];
// Configure the view for the selected state
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment