appearance:界面统一适配 UITableView/UIScrollView

新建UIApplication分类

#import "UIApplication+Helper.h"

+ (void)setupAppearance{
  //  [self setupNavigationbar];
    [self setupTableView];
    [self setupScrollview];
    
}

+ (void)setupTableView{
    if (@available(iOS 11.0, *)) {
        UITableView.appearance.estimatedRowHeight = 0.0;
        UITableView.appearance.estimatedSectionHeaderHeight = 0.0;
        UITableView.appearance.estimatedSectionFooterHeight = 0.0;
    }
}

+ (void)setupScrollview{
    if (@available(iOS 11.0, *)) {
        UIScrollView.appearance.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
    }
}
@end

//调用  
- (BOOL)application: didFinishLaunchingWithOptions: {

   [UIApplication setupAppearance];
}

支持 appearance 的类均适用。

你可能感兴趣的:(appearance:界面统一适配 UITableView/UIScrollView)