HomeViewController.m 2.6 KB
//
//  HomeViewController.m
//  DreamSleep
//
//  Created by peter on 2022/4/1.
//

#import "HomeViewController.h"
#import "DSGifHeader.h"
#import "HomeTableView.h"

@interface HomeViewController ()
@property (nonatomic, strong) HomeTableView *homeTV;
@end

@implementation HomeViewController

- (void)loadView {
    self.view = self.homeTV;
}

- (void)viewDidLoad {
    [super viewDidLoad];
        
    // 导航栏背景色
//    self.navigationController.navigationBar.dk_barTintColorPicker = DKColorPickerWithKey(NaviBG);
    
    // leftItem
    UILabel *leftLab = [[UILabel alloc] init];
    leftLab.text = @"小梦睡眠";
    leftLab.dk_textColorPicker = DKColorPickerWithKey(TEXT);
    leftLab.font = [UIFont boldSystemFontOfSize:24.0];
    [leftLab sizeToFit];
    UIBarButtonItem *leftItem = [[UIBarButtonItem alloc] initWithCustomView:leftLab];
    self.navigationItem.leftBarButtonItem = leftItem;
    
    // 隐藏导航栏分割线
//    self.navigationController.navigationBar.shadowImage = [UIImage new];
    
    // view背景色
//    self.view.dk_backgroundColorPicker = DKColorPickerWithKey(VCViewBG);
    
//    self.tableView.mj_header = [DSGifHeader headerWithRefreshingBlock:^{
//        dispatch_after(2.0, dispatch_get_main_queue(), ^{
//            [self.tableView.mj_header endRefreshing];
//        });
//    }];

//    // 设置导航栏返回按钮颜色
//    self.navigationController.navigationBar.tintColor = DSWhite;
//    // 设置导航栏背景色、title颜色、隐藏分割线
//    NSDictionary *titleTextAttributes = @{NSForegroundColorAttributeName:ColorFromHex(0x333333)};
//    if (@available(iOS 13.0, *)) {
//        UINavigationBarAppearance *appearance = [UINavigationBarAppearance new];
//        appearance.titleTextAttributes = titleTextAttributes;
//        appearance.backgroundColor = DSWhite;
//        appearance.shadowColor = [UIColor clearColor];
//        self.navigationController.navigationBar.standardAppearance = appearance;
//        self.navigationController.navigationBar.scrollEdgeAppearance = appearance;
//    } else {
//        self.navigationController.navigationBar.dk_barTintColorPicker = DKColorPickerWithKey(NaviBG);
//        [self.navigationController.navigationBar setTitleTextAttributes:titleTextAttributes];
//        self.navigationController.navigationBar.shadowImage = [UIImage new];
//    }
}

#pragma mark - 导航栏日间模式
- (NaviStyle)navigationBarStyle {
    return NaviStyleLight;
}

- (HomeTableView *)homeTV {
    if (!_homeTV) {
        _homeTV = [[HomeTableView alloc] initDemo];
    }
    return _homeTV;
}

@end