//
//  ERTCBaseViewController.m
//  ERTCDemo
//
//  Created by wangjinlong23 on 2022/10/28.
//

#import "ERTCBaseViewController.h"

@interface ERTCBaseViewController ()

@end

@implementation ERTCBaseViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    [self setup];
    
}

- (void)setup {
    self.edgesForExtendedLayout                       = UIRectEdgeNone;
    self.extendedLayoutIncludesOpaqueBars             = NO;
    self.modalPresentationCapturesStatusBarAppearance = NO;
    [self.navigationController.navigationBar setTranslucent:NO];
//    [self.navigationController.interactivePopGestureRecognizer setEnabled:YES];
//    _offsetY        = 0;
    [self.view setBackgroundColor:[UIColor YSSystemBackgroundPrimaryColor]];
    [self.view setFrame:CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, [UIScreen mainScreen].bounds.size.height)];
    
    if (@available(iOS 13.0, *)) {
        UINavigationBarAppearance * appearance = [[UINavigationBarAppearance alloc] init];
        // 背景色
        appearance.backgroundColor = [UIColor YSSystemBackgroundSecondaryColor];
        // 去除导航栏阴影（如果不设置clear，导航栏底下会有一条阴影线）
        appearance.shadowColor = [UIColor clearColor];
        // 字体颜色
        appearance.titleTextAttributes = @{NSForegroundColorAttributeName : [UIColor YSLabelColorPrimary]};
        // 带scroll滑动的页面
        self.navigationController.navigationBar.scrollEdgeAppearance = appearance;
        // 常规页面
        self.navigationController.navigationBar.standardAppearance = appearance;
    }
    else
    {
        [self.navigationController.navigationBar setTitleTextAttributes:@{NSForegroundColorAttributeName : [UIColor YSLabelColorPrimary]}];
        //这里增加一行设置导航栏颜色
        self.navigationController.navigationBar.barTintColor = [UIColor YSSystemBackgroundSecondaryColor];
    }
}

@end
