Created
April 3, 2014 19:28
-
-
Save maml/9961139 to your computer and use it in GitHub Desktop.
Category on UITableView that will prevent empty cells from rendering
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
// 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