UINavigationBar+Night.m
1.4 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
//
// UINavigationBar+Night.m
// UINavigationBar+Night
//
// Copyright (c) 2015 Draveness. All rights reserved.
//
// These files are generated by ruby script, if you want to modify code
// in this file, you are supposed to update the ruby code, run it and
// test it. And finally open a pull request.
#import "UINavigationBar+Night.h"
#import "DKNightVersionManager.h"
#import <objc/runtime.h>
@interface UINavigationBar ()
@property (nonatomic, strong) NSMutableDictionary<NSString *, DKColorPicker> *pickers;
@end
@implementation UINavigationBar (Night)
- (DKColorPicker)dk_barTintColorPicker {
return objc_getAssociatedObject(self, @selector(dk_barTintColorPicker));
}
- (void)dk_setBarTintColorPicker:(DKColorPicker)picker {
objc_setAssociatedObject(self, @selector(dk_barTintColorPicker), picker, OBJC_ASSOCIATION_COPY_NONATOMIC);
self.barTintColor = picker(self.dk_manager.themeVersion);
[self.pickers setValue:[picker copy] forKey:@"setBarTintColor:"];
}
- (DKColorPicker)dk_tintColorPicker {
return objc_getAssociatedObject(self, @selector(dk_tintColorPicker));
}
- (void)dk_setTintColorPicker:(DKColorPicker)picker {
objc_setAssociatedObject(self, @selector(dk_tintColorPicker), picker, OBJC_ASSOCIATION_COPY_NONATOMIC);
self.tintColor = picker(self.dk_manager.themeVersion);
[self.pickers setValue:[picker copy] forKey:@"setTintColor:"];
}
@end