forked from draveness/DKNightVersion
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPresentingViewController.m
More file actions
54 lines (41 loc) · 1.85 KB
/
PresentingViewController.m
File metadata and controls
54 lines (41 loc) · 1.85 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
//
// PresentingViewController.m
// DKNightVersion
//
// Created by Draveness on 15/5/10.
// Copyright (c) 2015年 DeltaX. All rights reserved.
//
#import "PresentingViewController.h"
#import <DKNightVersion/DKNightVersion.h>
@interface PresentingViewController ()
@end
@implementation PresentingViewController
- (void)viewDidLoad {
[super viewDidLoad];
UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
[button addTarget:self action:@selector(back) forControlEvents:UIControlEventTouchUpInside];
[button setFrame:CGRectMake(self.view.frame.size.height / 2.0, 0, self.view.frame.size.width, self.view.frame.size.height / 2.0)];
button.center = CGPointMake(self.view.center.x, self.view.center.y * 1.5);
[button setTitle:@"Back" forState:UIControlStateNormal];
UIButton *switchButton = [UIButton buttonWithType:UIButtonTypeCustom];
[switchButton addTarget:self action:@selector(switchColor) forControlEvents:UIControlEventTouchUpInside];
[switchButton setFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height / 2.0)];
switchButton.center = CGPointMake(self.view.center.x, self.view.center.y * 0.5);
[switchButton setTitle:@"SwitchColor" forState:UIControlStateNormal];
[self.view addSubview:button];
[self.view addSubview:switchButton];
self.view.dk_backgroundColorPicker = DKColorPickerWithKey(BG);
[button dk_setTitleColorPicker:DKColorPickerWithKey(TINT) forState:UIControlStateNormal];
[switchButton dk_setTitleColorPicker:DKColorPickerWithKey(TINT) forState:UIControlStateNormal];
}
- (void)back {
[self dismissViewControllerAnimated:YES completion:nil];
}
- (void)switchColor {
if ([self.dk_manager.themeVersion isEqualToString:DKThemeVersionNight]) {
[self.dk_manager dawnComing];
} else {
[self.dk_manager nightFalling];
}
}
@end