forked from Grouper/FlatUIKit
-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathViewController.m
More file actions
142 lines (120 loc) · 7.17 KB
/
ViewController.m
File metadata and controls
142 lines (120 loc) · 7.17 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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
//
// ViewController.m
// FlatUI
//
// Created by Jack Flintermann on 5/3/13.
// Copyright (c) 2013 Jack Flintermann. All rights reserved.
//
#import "ViewController.h"
#import "TableViewController.h"
#import "UIColor+FlatUI.h"
#import "UISlider+FlatUI.h"
#import "UIStepper+FlatUI.h"
#import "UITabBar+FlatUI.h"
#import "UINavigationBar+FlatUI.h"
#import "FUIButton.h"
#import "FUISwitch.h"
#import "UIFont+FlatUI.h"
#import "FUIAlertView.h"
#import "UIBarButtonItem+FlatUI.h"
#import "UIProgressView+FlatUI.h"
#import "FUISegmentedControl.h"
@interface ViewController ()
@property (weak, nonatomic) IBOutlet FUIButton *alertViewButton;
@property (weak, nonatomic) IBOutlet FUIButton *pushViewControllerButton;
@property (weak, nonatomic) IBOutlet UISlider *slider;
@property (weak, nonatomic) IBOutlet UIStepper *stepper;
@property (weak, nonatomic) IBOutlet FUISwitch *flatSwitch;
@property (strong, nonatomic) IBOutletCollection(UILabel) NSArray *labels;
@property (weak, nonatomic) IBOutlet UIProgressView *flatProgress;
@property (weak, nonatomic) IBOutlet FUISegmentedControl *flatSegmentedControl;
@end
@implementation ViewController
- (void)viewDidLoad
{
[super viewDidLoad];
self.title = @"Flat UI";
self.view.backgroundColor = [UIColor cloudsColor];
[UIBarButtonItem configureFlatButtonsWithColor:[UIColor peterRiverColor]
highlightedColor:[UIColor belizeHoleColor]
cornerRadius:3
whenContainedIn:[UINavigationBar class], nil];
self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"Plain Table"
style:UIBarButtonItemStylePlain
target:self
action:@selector(showPlainTableView:)];
[self.navigationItem.rightBarButtonItem removeTitleShadow];
self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"Grouped Table"
style:UIBarButtonItemStylePlain
target:self
action:@selector(showTableView:)];
[self.navigationItem.rightBarButtonItem removeTitleShadow];
[self.navigationItem.leftBarButtonItem configureFlatButtonWithColor:[UIColor alizarinColor]
highlightedColor:[UIColor pomegranateColor]
cornerRadius:3];
self.alertViewButton.buttonColor = [UIColor turquoiseColor];
self.alertViewButton.shadowColor = [UIColor greenSeaColor];
self.alertViewButton.shadowHeight = 3.0f;
self.alertViewButton.cornerRadius = 6.0f;
self.alertViewButton.titleLabel.font = [UIFont boldFlatFontOfSize:16];
[self.alertViewButton setTitleColor:[UIColor cloudsColor] forState:UIControlStateNormal];
[self.alertViewButton setTitleColor:[UIColor cloudsColor] forState:UIControlStateHighlighted];
self.pushViewControllerButton.buttonColor = [UIColor peterRiverColor];
self.pushViewControllerButton.shadowColor = [UIColor belizeHoleColor];
self.pushViewControllerButton.shadowHeight = 3.0f;
self.pushViewControllerButton.cornerRadius = 6.0f;
self.pushViewControllerButton.titleLabel.font = [UIFont boldFlatFontOfSize:16];
[self.pushViewControllerButton setTitleColor:[UIColor cloudsColor] forState:UIControlStateNormal];
[self.pushViewControllerButton setTitleColor:[UIColor cloudsColor] forState:UIControlStateHighlighted];
[self.slider configureFlatSliderWithTrackColor:[UIColor silverColor]
progressColor:[UIColor alizarinColor]
thumbColor:[UIColor pomegranateColor]];
[self.stepper configureFlatStepperWithColor:[UIColor wisteriaColor]
highlightedColor:[UIColor wisteriaColor]
disabledColor:[UIColor amethystColor]
iconColor:[UIColor cloudsColor]];
self.navigationController.navigationBar.titleTextAttributes = @{UITextAttributeFont: [UIFont boldFlatFontOfSize:18]};
[self.navigationController.navigationBar configureFlatNavigationBarWithColor:[UIColor midnightBlueColor]];
self.flatSwitch.onColor = [UIColor turquoiseColor];
self.flatSwitch.offColor = [UIColor cloudsColor];
self.flatSwitch.onBackgroundColor = [UIColor midnightBlueColor];
self.flatSwitch.offBackgroundColor = [UIColor silverColor];
self.flatSwitch.offLabel.font = [UIFont boldFlatFontOfSize:14];
self.flatSwitch.onLabel.font = [UIFont boldFlatFontOfSize:14];
[self.labels enumerateObjectsUsingBlock:^(UILabel *label, NSUInteger idx, BOOL *stop) {
label.font = [UIFont flatFontOfSize:16];
label.textColor = [UIColor midnightBlueColor];
}];
[self.flatProgress configureFlatProgressViewWithTrackColor:[UIColor silverColor] progressColor:[UIColor wisteriaColor]];
self.flatSegmentedControl.selectedFont = [UIFont boldFlatFontOfSize:16];
self.flatSegmentedControl.selectedFontColor = [UIColor cloudsColor];
self.flatSegmentedControl.deselectedFont = [UIFont flatFontOfSize:16];
self.flatSegmentedControl.deselectedFontColor = [UIColor cloudsColor];
self.flatSegmentedControl.selectedColor = [UIColor amethystColor];
self.flatSegmentedControl.deselectedColor = [UIColor silverColor];
self.flatSegmentedControl.dividerColor = [UIColor midnightBlueColor];
self.flatSegmentedControl.cornerRadius = 5.0;
}
- (IBAction)showAlertView:(id)sender {
FUIAlertView *alertView = [[FUIAlertView alloc] initWithTitle:@"Hello" message:@"This is an alert view" delegate:nil cancelButtonTitle:@"Dismiss" otherButtonTitles:@"Do Something", nil];
alertView.titleLabel.textColor = [UIColor cloudsColor];
alertView.titleLabel.font = [UIFont boldFlatFontOfSize:16];
alertView.messageLabel.textColor = [UIColor cloudsColor];
alertView.messageLabel.font = [UIFont flatFontOfSize:14];
alertView.backgroundOverlay.backgroundColor = [[UIColor cloudsColor] colorWithAlphaComponent:0.8];
alertView.alertContainer.backgroundColor = [UIColor midnightBlueColor];
alertView.defaultButtonColor = [UIColor cloudsColor];
alertView.defaultButtonShadowColor = [UIColor asbestosColor];
alertView.defaultButtonFont = [UIFont boldFlatFontOfSize:16];
alertView.defaultButtonTitleColor = [UIColor asbestosColor];
[alertView show];
}
- (void)showTableView:(id)sender {
TableViewController* tableViewController = [[TableViewController alloc] initWithStyle:UITableViewStyleGrouped];
[self.navigationController pushViewController:tableViewController animated:YES];
}
- (void)showPlainTableView:(id)sender {
TableViewController* tableViewController = [[TableViewController alloc] initWithStyle:UITableViewStylePlain];
[self.navigationController pushViewController:tableViewController animated:YES];
}
@end