Skip to content

Instantly share code, notes, and snippets.

@maml
Created April 3, 2014 19:28
Show Gist options
  • Save maml/9961139 to your computer and use it in GitHub Desktop.
Save maml/9961139 to your computer and use it in GitHub Desktop.
Category on UITableView that will prevent empty cells from rendering
// Put the following in a file called UITableView+PreventEmptyCells.h
#import <UIKit/UIKit.h>
@interface UITableView (PreventEmptyCells)
+ (void)preventEmptyRows:(UITableView *)tableView;
@end
// Put the following in a file called UITableView+PreventEmptyCells.m
#import "UITableView+PreventEmptyCells.h"
@implementation UITableView (PreventEmptyCells)
// prevents UITableView from filling in empty cells for the rest of the screen when there's not enough data
+ (void)preventEmptyRows:(UITableView *)tableView
{
tableView.tableFooterView = [[UIView alloc] initWithFrame:CGRectZero];
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment