Skip to content

Instantly share code, notes, and snippets.

@lightandshadow68
Last active June 15, 2020 15:08
Show Gist options
  • Save lightandshadow68/5483dd187dfa9eee075b1ad87e5f1101 to your computer and use it in GitHub Desktop.
Save lightandshadow68/5483dd187dfa9eee075b1ad87e5f1101 to your computer and use it in GitHub Desktop.
// UITableView+Appearance.h
// - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface UITableView (Appearance)<UIAppearance>
@property (nonatomic, assign) CGFloat footerViewHeight UI_APPEARANCE_SELECTOR;
@end
NS_ASSUME_NONNULL_END
// UITableView+Appearance.m
// - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#import "UITableView+Appearance.h"
@implementation UITableView (Appearance)
- (CGFloat)footerViewHeight
{
return self.tableFooterView.bounds.size.height;
}
- (void)setFooterViewHeight:(CGFloat)footerViewHeight
{
UIView *footerView = [[UIView alloc] init];
footerView.backgroundColor = UIColor.clearColor;
footerView.bounds = CGRectMake(0, 0, 0, footerViewHeight);
self.tableFooterView = footerView;
}
@end
// In your App / Scene Delegate
// - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#pragma mark - Appearance proxy customizations
- (void)performAppearanceProxyCustomizations
{
// ...
// No empty table view rows
[UITableView appearance].footerViewHeight = FLT_EPSILON;
// ...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment