Last active
June 15, 2020 15:08
-
-
Save lightandshadow68/5483dd187dfa9eee075b1ad87e5f1101 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
// 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