Skip to content

Commit 8045529

Browse files
committed
Merge commit 'c7f03f1fb31a57103d3f1e405eae57721ddc33cd'
2 parents 1beb0e8 + c7f03f1 commit 8045529

9 files changed

Lines changed: 76 additions & 141 deletions

File tree

QMUI/QMUIKit/QMUIKit.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ FOUNDATION_EXPORT const unsigned char QMUIKitVersionString[];
2525
#import <QMUIKit/QMUIHelper.h>
2626
#import <QMUIKit/QMUICommonDefines.h>
2727
#import <QMUIKit/QMUIConfiguration.h>
28-
#import <QMUIKit/QMUICommonUI.h>
2928

3029
/// QMUIKit
3130
#import <QMUIKit/QMUIVisualEffectView.h>
@@ -114,7 +113,6 @@ FOUNDATION_EXPORT const unsigned char QMUIKitVersionString[];
114113
#import "QMUIHelper.h"
115114
#import "QMUICommonDefines.h"
116115
#import "QMUIConfiguration.h"
117-
#import "QMUICommonUI.h"
118116

119117
/// QMUIKit
120118
#import "QMUIVisualEffectView.h"

QMUI/QMUIKit/UICommon/QMUICommonUI.h

Lines changed: 0 additions & 21 deletions
This file was deleted.

QMUI/QMUIKit/UICommon/QMUICommonUI.m

Lines changed: 0 additions & 52 deletions
This file was deleted.

QMUI/QMUIKit/UICommon/QMUIConfigurationManager.h

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
#import <UIKit/UIKit.h>
1111

1212
/**
13-
* 维护项目全局 UI 配置的单例,通过业务项目自己的 QMUIConfigurationTemplate 来为这个单例赋值,而业务代码里则通过 q 文件里的宏来使用这些值。
13+
* 维护项目全局 UI 配置的单例,通过业务项目自己的 QMUIConfigurationTemplate 来为这个单例赋值,而业务代码里则通过 QMUIConfiguration.h 文件里的宏来使用这些值。
1414
*/
1515
@interface QMUIConfigurationManager : NSObject
1616

@@ -199,3 +199,11 @@
199199
- (void)initDefaultConfiguration;
200200

201201
@end
202+
203+
@interface QMUIConfigurationManager (UIAppearance)
204+
205+
/**
206+
* 设置全局 UIAppearance 的代码,一般在 `application:didFinishLaunchingWithOptions:` 里手动调用(在调用 `[QMUIConfigurationTemplate setupConfigurationTemplate]` 之后)
207+
*/
208+
+ (void)renderGlobalAppearances;
209+
@end

QMUI/QMUIKit/UICommon/QMUIConfigurationManager.m

Lines changed: 51 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
#import "QMUICommonDefines.h"
1111
#import "QMUIConfiguration.h"
1212
#import "UIImage+QMUI.h"
13+
#import "QMUIButton.h"
14+
#import "QMUITabBarViewController.h"
1315

1416
@implementation QMUIConfigurationManager
1517

@@ -31,10 +33,9 @@ - (instancetype)init {
3133

3234
#pragma mark - 初始化默认值
3335

34-
- (void)initDefaultConfiguration
35-
{
36+
- (void)initDefaultConfiguration {
3637

37-
#pragma mark - Global Color
38+
#pragma mark - Global Color
3839

3940
self.clearColor = [UIColor colorWithRed:1 green:1 blue:1 alpha:0];
4041
self.whiteColor = [UIColor colorWithRed:1 green:1 blue:1 alpha:1];
@@ -46,7 +47,7 @@ - (void)initDefaultConfiguration
4647
self.greenColor = UIColorMake(79, 214, 79);
4748
self.blueColor = UIColorMake(43, 133, 208);
4849
self.yellowColor = UIColorMake(255, 252, 233);
49-
50+
5051
self.linkColor = UIColorMake(56, 116, 171);
5152
self.disabledColor = self.grayColor;
5253
self.backgroundColor = UIColorMake(246, 246, 246);
@@ -60,13 +61,13 @@ - (void)initDefaultConfiguration
6061
self.testColorGreen = UIColorMakeWithRGBA(0, 255, 0, .3);
6162
self.testColorBlue = UIColorMakeWithRGBA(0, 0, 255, .3);
6263

63-
#pragma mark - UIWindowLevel
64+
#pragma mark - UIWindowLevel
6465
self.windowLevelQMUIAlertView = UIWindowLevelAlert - 4.0;
6566
self.windowLevelQMUIActionSheet = UIWindowLevelAlert - 4.0;
6667
self.windowLevelQMUIMoreOperationController = UIWindowLevelStatusBar + 1;
6768
self.windowLevelQMUIImagePreviewView = UIWindowLevelStatusBar + 1;
6869

69-
#pragma mark - UIControl
70+
#pragma mark - UIControl
7071

7172
self.controlHighlightedAlpha = 0.5f;
7273
self.controlDisabledAlpha = 0.5f;
@@ -75,7 +76,7 @@ - (void)initDefaultConfiguration
7576
self.segmentTextSelectedTintColor = self.whiteColor;
7677
self.segmentFontSize = UIFontMake(13);
7778

78-
#pragma mark - UIButton
79+
#pragma mark - UIButton
7980

8081
self.buttonHighlightedAlpha = self.controlHighlightedAlpha;
8182
self.buttonDisabledAlpha = self.controlDisabledAlpha;
@@ -93,20 +94,20 @@ - (void)initDefaultConfiguration
9394
self.fillButtonColorGray = self.grayColor;
9495
self.fillButtonColorWhite = self.whiteColor;
9596

96-
#pragma mark - UITextField & UITextView
97+
#pragma mark - UITextField & UITextView
9798

9899
self.textFieldTintColor = UIColorBlue;
99100
self.textFieldTextInsets = UIEdgeInsetsMake(0, 7, 0, 7);
100101

101-
#pragma mark - ActionSheet
102+
#pragma mark - ActionSheet
102103

103104
self.actionSheetButtonTintColor = self.blueColor;
104105
self.actionSheetButtonBackgroundColor = UIColorMake(255, 255, 255);
105106
self.actionSheetButtonBackgroundColorHighlighted = UIColorMake(235, 235, 235);
106107
self.actionSheetButtonFont = UIFontMake(21);
107108
self.actionSheetButtonFontBold = UIFontBoldMake(21);
108109

109-
#pragma mark - NavigationBar
110+
#pragma mark - NavigationBar
110111

111112
self.navBarHighlightedAlpha = 0.2f;
112113
self.navBarDisabledAlpha = 0.2f;
@@ -130,7 +131,7 @@ - (void)initDefaultConfiguration
130131
self.navBarActivityIndicatorViewStyle = UIActivityIndicatorViewStyleGray;
131132
self.navBarAccessoryViewTypeDisclosureIndicatorImage = [[UIImage imageWithShape:QMUIImageShapeTriangle size:CGSizeMake(8, 5) tintColor:self.whiteColor] imageWithOrientation:UIImageOrientationDown];
132133

133-
#pragma mark - TabBar
134+
#pragma mark - TabBar
134135

135136
self.tabBarBackgroundImage = nil;
136137
self.tabBarBarTintColor = nil;
@@ -139,7 +140,7 @@ - (void)initDefaultConfiguration
139140
self.tabBarItemTitleColor = UIColorMake(119, 119, 119);
140141
self.tabBarItemTitleColorSelected = self.tabBarTintColor;
141142

142-
#pragma mark - Toolbar
143+
#pragma mark - Toolbar
143144

144145
self.toolBarHighlightedAlpha = 0.4f;
145146
self.toolBarDisabledAlpha = 0.4f;
@@ -151,7 +152,7 @@ - (void)initDefaultConfiguration
151152
self.toolBarShadowImageColor = UIColorMake(178, 178, 178);
152153
self.toolBarButtonFont = UIFontMake(17);
153154

154-
#pragma mark - SearchBar
155+
#pragma mark - SearchBar
155156

156157
self.searchBarTextFieldBackground = self.whiteColor;
157158
self.searchBarTextFieldBorderColor = UIColorMake(205, 208, 210);
@@ -164,7 +165,7 @@ - (void)initDefaultConfiguration
164165
self.searchBarClearIconImage = nil;
165166
self.searchBarTextFieldCornerRadius = 2.0;
166167

167-
#pragma mark - TableView / TableViewCell
168+
#pragma mark - TableView / TableViewCell
168169

169170
self.tableViewBackgroundColor = self.whiteColor;
170171
self.tableViewGroupedBackgroundColor = self.backgroundColor;
@@ -204,7 +205,7 @@ - (void)initDefaultConfiguration
204205
self.tableViewCellContentDefaultPaddingLeft = 15;
205206
self.tableViewCellContentDefaultPaddingRight = 10;
206207

207-
#pragma mark - Others
208+
#pragma mark - Others
208209

209210
self.supportedOrientationMask = UIInterfaceOrientationMaskPortrait;
210211
self.statusbarStyleLightInitially = NO;
@@ -213,3 +214,38 @@ - (void)initDefaultConfiguration
213214
}
214215

215216
@end
217+
218+
@implementation QMUIConfigurationManager (UIAppearance)
219+
220+
+ (void)renderGlobalAppearances {
221+
222+
// QMUIButton
223+
[QMUINavigationButton renderNavigationButtonAppearanceStyle];
224+
[QMUIToolbarButton renderToolbarButtonAppearanceStyle];
225+
226+
// UINavigationBar
227+
UINavigationBar *navigationBarAppearance = [UINavigationBar appearance];
228+
[navigationBarAppearance setBarTintColor:NavBarBarTintColor];
229+
[navigationBarAppearance setBackgroundImage:NavBarBackgroundImage forBarMetrics:UIBarMetricsDefault];
230+
[navigationBarAppearance setShadowImage:NavBarShadowImage];
231+
232+
// UIToolBar
233+
UIToolbar *toolBarAppearance = [UIToolbar appearance];
234+
[toolBarAppearance setBarTintColor:ToolBarBarTintColor];
235+
[toolBarAppearance setBackgroundImage:ToolBarBackgroundImage forToolbarPosition:UIBarPositionAny barMetrics:UIBarMetricsDefault];
236+
[toolBarAppearance setShadowImage:[UIImage imageWithColor:ToolBarShadowImageColor size:CGSizeMake(1, PixelOne) cornerRadius:0] forToolbarPosition:UIBarPositionAny];
237+
238+
// UITabBar
239+
UITabBar *tabBarAppearance = [UITabBar appearance];
240+
[tabBarAppearance setBarTintColor:TabBarBarTintColor];
241+
[tabBarAppearance setBackgroundImage:TabBarBackgroundImage];
242+
[tabBarAppearance setShadowImage:[UIImage imageWithColor:TabBarShadowImageColor size:CGSizeMake(1, PixelOne) cornerRadius:0]];
243+
244+
245+
// UITabBarItem
246+
UITabBarItem *tabBarItemAppearance = [UITabBarItem appearanceWhenContainedIn:[QMUITabBarViewController class], nil];
247+
[tabBarItemAppearance setTitleTextAttributes:@{NSForegroundColorAttributeName:TabBarItemTitleColor} forState:UIControlStateNormal];
248+
[tabBarItemAppearance setTitleTextAttributes:@{NSForegroundColorAttributeName:TabBarItemTitleColorSelected} forState:UIControlStateSelected];
249+
}
250+
251+
@end

QMUI/QMUIKit/UICommon/QMUIConfigurationTemplate.m

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
//
88

99
#import "QMUIConfigurationTemplate.h"
10-
//#import <QMUIKit/QMUIKit.h>
10+
#import <QMUIKit/QMUIKit.h>
1111

1212
// 此文件仅供复制使用,不能加到静态库的Compile Sources里面。
1313

@@ -31,7 +31,7 @@ + (void)setupConfigurationTemplate {
3131

3232
// === 修改配置值 === //
3333

34-
#pragma mark - Global Color
34+
#pragma mark - Global Color
3535

3636
//- QMUICMI.clearColor = [UIColor colorWithRed:1 green:1 blue:1 alpha:0]; // UIColorClear
3737
//- QMUICMI.whiteColor = [UIColor colorWithRed:1 green:1 blue:1 alpha:1]; // UIColorWhite
@@ -59,7 +59,7 @@ + (void)setupConfigurationTemplate {
5959
//- QMUICMI.testColorBlue = UIColorMakeWithRGBA(0, 0, 255, .3);
6060

6161

62-
#pragma mark - UIControl
62+
#pragma mark - UIControl
6363

6464
//- QMUICMI.controlDisabledAlpha = 0.5f; // UIControlHighlightedAlpha : 全局的highlighted alpha值
6565
//- QMUICMI.controlDisabledAlpha = 0.5f; // UIControlDisabledAlpha : 全局的disabled alpha值
@@ -68,7 +68,7 @@ + (void)setupConfigurationTemplate {
6868
//- QMUICMI.segmentTextSelectedTintColor = UIColorWhite; // SegmentTextSelectedTintColor : segment选中态的tintColor
6969
//- QMUICMI.segmentFontSize = UIFontMake(13); // SegmentFontSize : segment的字体大小
7070

71-
#pragma mark - UIButton
71+
#pragma mark - UIButton
7272
//- QMUICMI.buttonHighlightedAlpha = UIControlHighlightedAlpha; // ButtonHighlightedAlpha : 按钮的highlighted alpha值
7373
//- QMUICMI.buttonDisabledAlpha = UIControlDisabledAlpha; // ButtonDisabledAlpha : 按钮的disabled alpha值
7474
//- QMUICMI.buttonTintColor = UIColorBlue; // ButtonTintColor : 按钮默认的tintColor
@@ -86,18 +86,18 @@ + (void)setupConfigurationTemplate {
8686
//- QMUICMI.fillButtonColorWhite = UIColorWhite; // FillButtonColorWhite
8787

8888

89-
#pragma mark - TextField & TextView
89+
#pragma mark - TextField & TextView
9090
//- QMUICMI.textFieldTintColor = UIColorBlue; // TextFieldTintColor : 全局UITextField、UITextView的tintColor
9191
//- QMUICMI.textFieldTextInsets = UIEdgeInsetsMake(0, 7, 0, 7); // TextFieldTextInsets : QMUITextField的内边距
9292

93-
#pragma mark - ActionSheet
93+
#pragma mark - ActionSheet
9494
//- QMUICMI.actionSheetButtonTintColor = UIColorBlue; // ActionSheetButtonTintColor
9595
//- QMUICMI.actionSheetButtonBackgroundColor = UIColorMake(255, 255, 255); // ActionSheetButtonBackgroundColor
9696
//- QMUICMI.actionSheetButtonBackgroundColorHighlighted = UIColorMake(235, 235, 235); // ActionSheetButtonBackgroundColorHighlighted
9797
//- QMUICMI.actionSheetButtonFont = UIFontMake(21); // ActionSheetButtonFont
9898
//- QMUICMI.actionSheetButtonFontBold = UIFontBoldMake(21); // ActionSheetButtonFontBold
9999

100-
#pragma mark - NavigationBar
100+
#pragma mark - NavigationBar
101101

102102
//- QMUICMI.navBarHighlightedAlpha = 0.2f; // NavBarHighlightedAlpha
103103
//- QMUICMI.navBarDisabledAlpha = 0.2f; // NavBarDisabledAlpha
@@ -120,7 +120,7 @@ + (void)setupConfigurationTemplate {
120120
//- QMUICMI.navBarActivityIndicatorViewStyle = UIActivityIndicatorViewStyleGray; // NavBarActivityIndicatorViewStyle
121121
//- QMUICMI.navBarAccessoryViewTypeDisclosureIndicatorImage = [UIImage imageWithShape:QMUIImageShapeTriangle size:CGSizeMake(8, 5) tintColor:UIColorWhite]; // NavBarAccessoryViewTypeDisclosureIndicatorImage
122122

123-
#pragma mark - TabBar
123+
#pragma mark - TabBar
124124

125125
//- QMUICMI.tabBarBackgroundImage = nil; // TabBarBackgroundImage
126126
//- QMUICMI.tabBarBarTintColor = nil; // TabBarBarTintColor
@@ -129,7 +129,7 @@ + (void)setupConfigurationTemplate {
129129
//- QMUICMI.tabBarItemTitleColor = UIColorMake(119, 119, 119); // TabBarItemTitleColor
130130
//- QMUICMI.tabBarItemTitleColorSelected = TabBarTintColor; // TabBarItemTitleColorSelected
131131

132-
#pragma mark - Toolbar
132+
#pragma mark - Toolbar
133133

134134
//- QMUICMI.toolBarHighlightedAlpha = 0.4f; // ToolBarHighlightedAlpha
135135
//- QMUICMI.toolBarDisabledAlpha = 0.4f; // ToolBarDisabledAlpha
@@ -141,7 +141,7 @@ + (void)setupConfigurationTemplate {
141141
//- QMUICMI.toolBarShadowImageColor = UIColorMake(178, 178, 178); // ToolBarShadowImageColor
142142
//- QMUICMI.toolBarButtonFont = UIFontMake(17); // ToolBarButtonFont
143143

144-
#pragma mark - SearchBar
144+
#pragma mark - SearchBar
145145

146146
//- QMUICMI.searchBarTextFieldBackground = UIColorWhite; // SearchBarTextFieldBackground
147147
//- QMUICMI.searchBarTextFieldBorderColor = UIColorMake(205, 208, 210); // SearchBarTextFieldBorderColor
@@ -154,7 +154,7 @@ + (void)setupConfigurationTemplate {
154154
//- QMUICMI.searchBarClearIconImage = nil; // SearchBarClearIconImage
155155
//- QMUICMI.searchBarTextFieldCornerRadius = 2.0; // SearchBarTextFieldCornerRadius
156156

157-
#pragma mark - TableView / TableViewCell
157+
#pragma mark - TableView / TableViewCell
158158

159159
//- QMUICMI.tableViewBackgroundColor = UIColorWhite; // TableViewBackgroundColor
160160
//- QMUICMI.tableViewGroupedBackgroundColor = UIColorForBackground; // TableViewGroupedBackgroundColor
@@ -194,13 +194,13 @@ + (void)setupConfigurationTemplate {
194194
//- QMUICMI.tableViewCellContentDefaultPaddingLeft = 15; // TableViewCellContentDefaultPaddingLeft
195195
//- QMUICMI.tableViewCellContentDefaultPaddingRight = 10; // TableViewCellContentDefaultPaddingRight
196196

197-
#pragma mark - UIWindowLevel
197+
#pragma mark - UIWindowLevel
198198
//- QMUICMI.windowLevelQMUIAlertView = UIWindowLevelAlert - 4.0; // UIWindowLevelQMUIAlertView
199199
//- QMUICMI.windowLevelQMUIActionSheet = UIWindowLevelAlert - 4.0; // UIWindowLevelQMUIActionSheet
200200
//- QMUICMI.windowLevelQMUIMoreOperationController = UIWindowLevelStatusBar + 1.0; // UIWindowLevelQMUIMoreOperationController
201201
//- QMUICMI.windowLevelQMUIImagePreviewView = UIWindowLevelStatusBar + 1.0; // UIWindowLevelQMUIImagePreviewView
202202

203-
#pragma mark - Others
203+
#pragma mark - Others
204204

205205
//- QMUICMI.supportedOrientationMask = UIInterfaceOrientationMaskPortrait; // SupportedOrientationMask : 默认支持的横竖屏方向
206206
//- QMUICMI.statusbarStyleLightInitially = NO; // StatusbarStyleLightInitially : 默认的状态栏内容是否使用白色,默认为NO,也即黑色

QMUI/QMUI_iOS.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Pod::Spec.new do |s|
22
s.name = "QMUI_iOS"
3-
s.version = "1.0.5"
3+
s.version = "1.0.1"
44
s.summary = "致力于提高项目 UI 开发效率的解决方案"
55
s.description = <<-DESC
66
QMUI iOS 是一个致力于提高项目 UI 开发效率的解决方案,其设计目的是用于辅助快速搭建一个具备基本设计还原效果的 iOS 项目,同时利用自身提供的丰富控件及兼容处理, 让开发者能专注于业务需求而无需耗费精力在基础代码的设计上。不管是新项目的创建,或是已有项目的维护,均可使开发效率和项目质量得到大幅度提升。

0 commit comments

Comments
 (0)