HomeViewController.m
3.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
//
// 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)viewDidLoad {
[super viewDidLoad];
self.view = self.homeTV;
// 导航栏背景色
// 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.navigationItem.backBarButtonItem = [[UIBarButtonItem alloc]
initWithTitle:@""
style:UIBarButtonItemStylePlain
target:self
action:nil];
// 设置导航栏返回按钮颜色
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 - Table view data source
//- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
// return 1;
//}
//
//- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
// UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"homeCell" forIndexPath:indexPath];
// return cell;
//}
- (HomeTableView *)homeTV {
if (!_homeTV) {
_homeTV = [[HomeTableView alloc] initDemo];
}
return _homeTV;
}
@end