@@ -61,21 +61,11 @@ - (void)initDefaultConfiguration {
6161 self.testColorGreen = UIColorMakeWithRGBA (0 , 255 , 0 , .3 );
6262 self.testColorBlue = UIColorMakeWithRGBA (0 , 0 , 255 , .3 );
6363
64- #pragma mark - UIWindowLevel
65- self.windowLevelQMUIAlertView = UIWindowLevelAlert - 4.0 ;
66- self.windowLevelQMUIActionSheet = UIWindowLevelAlert - 4.0 ;
67- self.windowLevelQMUIMoreOperationController = UIWindowLevelStatusBar + 1 ;
68- self.windowLevelQMUIImagePreviewView = UIWindowLevelStatusBar + 1 ;
69-
7064 #pragma mark - UIControl
7165
7266 self.controlHighlightedAlpha = 0 .5f ;
7367 self.controlDisabledAlpha = 0 .5f ;
7468
75- self.segmentTextTintColor = self.blueColor ;
76- self.segmentTextSelectedTintColor = self.whiteColor ;
77- self.segmentFontSize = UIFontMake (13 );
78-
7969 #pragma mark - UIButton
8070
8171 self.buttonHighlightedAlpha = self.controlHighlightedAlpha ;
@@ -99,14 +89,6 @@ - (void)initDefaultConfiguration {
9989 self.textFieldTintColor = UIColorBlue;
10090 self.textFieldTextInsets = UIEdgeInsetsMake (0 , 7 , 0 , 7 );
10191
102- #pragma mark - ActionSheet
103-
104- self.actionSheetButtonTintColor = self.blueColor ;
105- self.actionSheetButtonBackgroundColor = UIColorMake (255 , 255 , 255 );
106- self.actionSheetButtonBackgroundColorHighlighted = UIColorMake (235 , 235 , 235 );
107- self.actionSheetButtonFont = UIFontMake (21 );
108- self.actionSheetButtonFontBold = UIFontBoldMake (21 );
109-
11092 #pragma mark - NavigationBar
11193
11294 self.navBarHighlightedAlpha = 0 .2f ;
@@ -115,10 +97,9 @@ - (void)initDefaultConfiguration {
11597 self.navBarButtonFontBold = UIFontBoldMake (17 );
11698 self.navBarBackgroundImage = nil ;
11799 self.navBarShadowImage = nil ;
118- self.navBarShadowImageColor = UIColorMake (178 , 178 , 178 );
119100 self.navBarBarTintColor = nil ;
120101 self.navBarTintColor = self.blackColor ;
121- self.navBarTitleColor = nil ;
102+ self.navBarTitleColor = self. navBarTintColor ;
122103 self.navBarTitleFont = UIFontBoldMake (17 );
123104 self.navBarBackButtonTitlePositionAdjustment = UIOffsetZero;
124105 self.navBarBackIndicatorImage = [UIImage qmui_imageWithShape: QMUIImageShapeNavBack size: CGSizeMake (12 , 20 ) tintColor: self .navBarTintColor];
@@ -157,7 +138,7 @@ - (void)initDefaultConfiguration {
157138 self.searchBarBottomBorderColor = UIColorMake (205 , 208 , 210 );
158139 self.searchBarBarTintColor = UIColorMake (247 , 247 , 247 );
159140 self.searchBarTintColor = self.blueColor ;
160- self.searchBarTextColor = UIColorBlack ;
141+ self.searchBarTextColor = self. blackColor ;
161142 self.searchBarPlaceholderColor = self.placeholderColor ;
162143 self.searchBarSearchIconImage = nil ;
163144 self.searchBarClearIconImage = nil ;
@@ -171,13 +152,18 @@ - (void)initDefaultConfiguration {
171152 self.tableSectionIndexBackgroundColor = self.clearColor ;
172153 self.tableSectionIndexTrackingBackgroundColor = self.clearColor ;
173154 self.tableViewSeparatorColor = self.separatorColor ;
155+
156+ self.tableViewCellNormalHeight = 44 ;
157+ self.tableViewCellTitleLabelColor = self.blackColor ;
158+ self.tableViewCellDetailLabelColor = self.grayColor ;
159+ self.tableViewCellContentDefaultPaddingLeft = 15 ;
160+ self.tableViewCellContentDefaultPaddingRight = 10 ;
174161 self.tableViewCellBackgroundColor = self.whiteColor ;
175162 self.tableViewCellSelectedBackgroundColor = UIColorMake (232 , 232 , 232 );
176163 self.tableViewCellWarningBackgroundColor = self.yellowColor ;
177- self.tableViewCellNormalHeight = 44 ;
178-
179164 self.tableViewCellDisclosureIndicatorImage = [UIImage qmui_imageWithShape: QMUIImageShapeDisclosureIndicator size: CGSizeMake (8 , 13 ) tintColor: UIColorMakeWithRGBA (0 , 0 , 0 , .2 )];
180165 self.tableViewCellCheckmarkImage = [UIImage qmui_imageWithShape: QMUIImageShapeCheckmark size: CGSizeMake (15 , 12 ) tintColor: UIColorBlue];
166+
181167 self.tableViewSectionHeaderBackgroundColor = UIColorMake (244 , 244 , 244 );
182168 self.tableViewSectionFooterBackgroundColor = UIColorMake (244 , 244 , 244 );
183169 self.tableViewSectionHeaderFont = UIFontBoldMake (12 );
@@ -198,10 +184,11 @@ - (void)initDefaultConfiguration {
198184 self.tableViewGroupedSectionHeaderContentInset = UIEdgeInsetsMake (16 , 15 , 8 , 15 );
199185 self.tableViewGroupedSectionFooterContentInset = UIEdgeInsetsMake (8 , 15 , 2 , 15 );
200186
201- self.tableViewCellTitleLabelColor = self.blackColor ;
202- self.tableViewCellDetailLabelColor = self.grayColor ;
203- self.tableViewCellContentDefaultPaddingLeft = 15 ;
204- self.tableViewCellContentDefaultPaddingRight = 10 ;
187+ #pragma mark - UIWindowLevel
188+ self.windowLevelQMUIAlertView = UIWindowLevelAlert - 4.0 ;
189+ self.windowLevelQMUIActionSheet = UIWindowLevelAlert - 4.0 ;
190+ self.windowLevelQMUIMoreOperationController = UIWindowLevelStatusBar + 1 ;
191+ self.windowLevelQMUIImagePreviewView = UIWindowLevelStatusBar + 1 ;
205192
206193 #pragma mark - Others
207194
@@ -225,26 +212,52 @@ + (void)renderGlobalAppearances {
225212 UINavigationBar *navigationBarAppearance = [UINavigationBar appearance ];
226213 navigationBarAppearance.barTintColor = NavBarBarTintColor;
227214 navigationBarAppearance.shadowImage = NavBarShadowImage;
228- navigationBarAppearance.titleTextAttributes = @{NSFontAttributeName : NavBarTitleFont, NSForegroundColorAttributeName : NavBarTitleColor};
229215 [navigationBarAppearance setBackgroundImage: NavBarBackgroundImage forBarMetrics: UIBarMetricsDefault];
230216
217+ UIFont *navigationBarTitleFont = NavBarTitleFont;
218+ UIColor *navigationBarTitleColor = NavBarTitleColor;
219+ if (navigationBarTitleFont || navigationBarTitleColor) {
220+ NSMutableDictionary <NSString *, id > *titleTextAttributes = [[NSMutableDictionary alloc ] init ];
221+ if (navigationBarTitleFont) {
222+ [titleTextAttributes setValue: navigationBarTitleFont forKey: NSFontAttributeName ];
223+ }
224+ if (navigationBarTitleColor) {
225+ [titleTextAttributes setValue: navigationBarTitleColor forKey: NSForegroundColorAttributeName ];
226+ }
227+ navigationBarAppearance.titleTextAttributes = titleTextAttributes;
228+ }
229+
231230 // UIToolBar
232231 UIToolbar *toolBarAppearance = [UIToolbar appearance ];
233232 toolBarAppearance.barTintColor = ToolBarBarTintColor;
234233 [toolBarAppearance setBackgroundImage: ToolBarBackgroundImage forToolbarPosition: UIBarPositionAny barMetrics: UIBarMetricsDefault];
235- [toolBarAppearance setShadowImage: [UIImage qmui_imageWithColor: ToolBarShadowImageColor size: CGSizeMake (1 , PixelOne) cornerRadius: 0 ] forToolbarPosition: UIBarPositionAny];
234+
235+ UIColor *toolbarShadowImageColor = ToolBarShadowImageColor;
236+ if (toolbarShadowImageColor) {
237+ [toolBarAppearance setShadowImage: [UIImage qmui_imageWithColor: toolbarShadowImageColor size: CGSizeMake (1 , PixelOne) cornerRadius: 0 ] forToolbarPosition: UIBarPositionAny];
238+ }
236239
237240 // UITabBar
238241 UITabBar *tabBarAppearance = [UITabBar appearance ];
239242 tabBarAppearance.barTintColor = TabBarBarTintColor;
240243 tabBarAppearance.backgroundImage = TabBarBackgroundImage;
241- [tabBarAppearance setShadowImage: [UIImage qmui_imageWithColor: TabBarShadowImageColor size: CGSizeMake (1 , PixelOne) cornerRadius: 0 ]];
242-
244+ UIColor *tabBarShadowImageColor = TabBarShadowImageColor;
245+ if (tabBarShadowImageColor) {
246+ [tabBarAppearance setShadowImage: [UIImage qmui_imageWithColor: tabBarShadowImageColor size: CGSizeMake (1 , PixelOne) cornerRadius: 0 ]];
247+ }
243248
244249 // UITabBarItem
245250 UITabBarItem *tabBarItemAppearance = [UITabBarItem appearance ];
246- [tabBarItemAppearance setTitleTextAttributes: @{NSForegroundColorAttributeName :TabBarItemTitleColor} forState: UIControlStateNormal];
247- [tabBarItemAppearance setTitleTextAttributes: @{NSForegroundColorAttributeName :TabBarItemTitleColorSelected} forState: UIControlStateSelected];
251+
252+ UIColor *tabBarItemTitleColor = TabBarItemTitleColor;
253+ if (tabBarItemTitleColor) {
254+ [tabBarItemAppearance setTitleTextAttributes: @{NSForegroundColorAttributeName :tabBarItemTitleColor} forState: UIControlStateNormal];
255+ }
256+
257+ UIColor *tabBarItemTitleColorSelected = TabBarItemTitleColorSelected;
258+ if (tabBarItemTitleColorSelected) {
259+ [tabBarItemAppearance setTitleTextAttributes: @{NSForegroundColorAttributeName :tabBarItemTitleColorSelected} forState: UIControlStateSelected];
260+ }
248261}
249262
250263@end
0 commit comments