Commit 6dda2266 cgx

修复导航栏背景色在iOS13以下系统问题

1 个父辈 a02f85c8
...@@ -34,23 +34,6 @@ ...@@ -34,23 +34,6 @@
[self initView]; [self initView];
[self setNaviRightBtn]; [self setNaviRightBtn];
// // 设置导航栏返回按钮颜色
// self.navigationController.navigationBar.tintColor = DSWhite;
// // 设置导航栏背景色、title颜色、隐藏分割线
// NSDictionary *titleTextAttributes = @{NSForegroundColorAttributeName:DSWhite};
// if (@available(iOS 13.0, *)) {
// UINavigationBarAppearance *appearance = [UINavigationBarAppearance new];
// appearance.titleTextAttributes = titleTextAttributes;
// appearance.backgroundColor = self.view.backgroundColor;
// appearance.shadowColor = [UIColor clearColor];
// self.navigationController.navigationBar.standardAppearance = appearance;
// self.navigationController.navigationBar.scrollEdgeAppearance = appearance;
// } else {
// self.navigationController.navigationBar.barTintColor = self.view.backgroundColor;
// [self.navigationController.navigationBar setTitleTextAttributes:titleTextAttributes];
// self.navigationController.navigationBar.shadowImage = [UIImage new];
// }
} }
#pragma mark - 导航栏夜间模式 #pragma mark - 导航栏夜间模式
......
...@@ -8,7 +8,6 @@ ...@@ -8,7 +8,6 @@
#import "BaseNaviController.h" #import "BaseNaviController.h"
@interface BaseNaviController () @interface BaseNaviController ()
@end @end
@implementation BaseNaviController @implementation BaseNaviController
...@@ -16,35 +15,8 @@ ...@@ -16,35 +15,8 @@
- (void)viewDidLoad { - (void)viewDidLoad {
[super viewDidLoad]; [super viewDidLoad];
// // 设置导航栏返回按钮文字 // 设置导航栏返回按钮颜色
// self.navigationItem.backBarButtonItem = [[UIBarButtonItem alloc] self.navigationBar.tintColor = DSWhite;
// initWithTitle:@""
// style:UIBarButtonItemStylePlain
// target:self
// action:nil];
// // 设置导航栏返回按钮颜色
// self.navigationController.navigationBar.tintColor = DSWhite;
// // 设置导航栏背景色、title颜色、隐藏分割线
// NSDictionary *titleTextAttributes = @{NSForegroundColorAttributeName:ColorFromHex(0x333333)};
// if (@available(iOS 13.0, *)) {
// UINavigationBarAppearance *appearance = [UINavigationBarAppearance new];
// appearance.titleTextAttributes = titleTextAttributes;
// appearance.backgroundColor = DSWhite;
// appearance.shadowColor = [UIColor clearColor];
// self.navigationController.navigationBar.standardAppearance = appearance;
// self.navigationController.navigationBar.scrollEdgeAppearance = appearance;
// } else {
// self.navigationController.navigationBar.dk_barTintColorPicker = DKColorPickerWithKey(NaviBG);
// [self.navigationController.navigationBar setTitleTextAttributes:titleTextAttributes];
// self.navigationController.navigationBar.shadowImage = [UIImage new];
// }
// 设置导航栏返回按钮文字
// self.navigationItem.backBarButtonItem = [[UIBarButtonItem alloc]
// initWithTitle:@""
// style:UIBarButtonItemStylePlain
// target:self
// action:nil];
} }
+ (void)setNavigationBarStyle:(NaviStyle)style vc:(UIViewController *)vc { + (void)setNavigationBarStyle:(NaviStyle)style vc:(UIViewController *)vc {
...@@ -60,20 +32,26 @@ ...@@ -60,20 +32,26 @@
barTintColor = DarkColor; barTintColor = DarkColor;
} }
// 设置导航栏返回按钮颜色 // 设置导航栏title颜色、导航栏背景色、隐藏分割线
naviBar.tintColor = DSWhite;
// 设置导航栏背景色、title颜色、隐藏分割线
NSDictionary *titleTextAttributes = @{NSForegroundColorAttributeName:titleColor}; NSDictionary *titleTextAttributes = @{NSForegroundColorAttributeName:titleColor};
if (@available(iOS 13.0, *)) { if (@available(iOS 13.0, *)) {
UINavigationBarAppearance *appearance = [UINavigationBarAppearance new]; UINavigationBarAppearance *appearance = [UINavigationBarAppearance new];
// 导航栏title颜色
appearance.titleTextAttributes = titleTextAttributes; appearance.titleTextAttributes = titleTextAttributes;
// 导航栏背景色
appearance.backgroundColor = bgColor; appearance.backgroundColor = bgColor;
appearance.shadowColor = [UIColor clearColor]; // 隐藏分割线
naviBar.standardAppearance = appearance; appearance.shadowColor = DSClearColor;
// 生效
naviBar.scrollEdgeAppearance = appearance; naviBar.scrollEdgeAppearance = appearance;
// naviBar.standardAppearance = appearance;
} else { } else {
naviBar.barTintColor = barTintColor; // 导航栏title颜色
[naviBar setTitleTextAttributes:titleTextAttributes]; [naviBar setTitleTextAttributes:titleTextAttributes];
// 导航栏背景色
naviBar.barTintColor = barTintColor;
naviBar.translucent = NO;
// 隐藏分割线
naviBar.shadowImage = [UIImage new]; naviBar.shadowImage = [UIImage new];
} }
} }
......
...@@ -507,7 +507,7 @@ ...@@ -507,7 +507,7 @@
4EEE47F47E6D04E29FBE7E09D4A1CCDC /* YTKNetworkPrivate.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = YTKNetworkPrivate.m; path = YTKNetwork/YTKNetworkPrivate.m; sourceTree = "<group>"; }; 4EEE47F47E6D04E29FBE7E09D4A1CCDC /* YTKNetworkPrivate.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = YTKNetworkPrivate.m; path = YTKNetwork/YTKNetworkPrivate.m; sourceTree = "<group>"; };
513A5A4B9156B9A00DCFC5E08A81FAC3 /* LOTGradientFillRender.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = LOTGradientFillRender.h; path = "lottie-ios/Classes/RenderSystem/RenderNodes/LOTGradientFillRender.h"; sourceTree = "<group>"; }; 513A5A4B9156B9A00DCFC5E08A81FAC3 /* LOTGradientFillRender.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = LOTGradientFillRender.h; path = "lottie-ios/Classes/RenderSystem/RenderNodes/LOTGradientFillRender.h"; sourceTree = "<group>"; };
514420A76EB3160AF5A0C38481A2B32B /* MJRefreshHeader.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = MJRefreshHeader.h; path = MJRefresh/Base/MJRefreshHeader.h; sourceTree = "<group>"; }; 514420A76EB3160AF5A0C38481A2B32B /* MJRefreshHeader.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = MJRefreshHeader.h; path = MJRefresh/Base/MJRefreshHeader.h; sourceTree = "<group>"; };
51BA97E8B5085EFFB47BC9C0B785CEA7 /* lottie-ios */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; name = "lottie-ios"; path = Lottie.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 51BA97E8B5085EFFB47BC9C0B785CEA7 /* Lottie.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Lottie.framework; sourceTree = BUILT_PRODUCTS_DIR; };
532DA45C34FBFD5D3B2F4C1E00DC890E /* LOTShapeTrimPath.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = LOTShapeTrimPath.h; path = "lottie-ios/Classes/Models/LOTShapeTrimPath.h"; sourceTree = "<group>"; }; 532DA45C34FBFD5D3B2F4C1E00DC890E /* LOTShapeTrimPath.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = LOTShapeTrimPath.h; path = "lottie-ios/Classes/Models/LOTShapeTrimPath.h"; sourceTree = "<group>"; };
53DC3490B7639337FD3A77BE6294E3F6 /* DKAlpha.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = DKAlpha.h; path = DKNightVersion/Core/DKAlpha.h; sourceTree = "<group>"; }; 53DC3490B7639337FD3A77BE6294E3F6 /* DKAlpha.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = DKAlpha.h; path = DKNightVersion/Core/DKAlpha.h; sourceTree = "<group>"; };
54DCCF8ADE70B7EF2160D30D40C377D1 /* UIControl+Night.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = "UIControl+Night.h"; path = "DKNightVersion/UIKit/UIControl+Night.h"; sourceTree = "<group>"; }; 54DCCF8ADE70B7EF2160D30D40C377D1 /* UIControl+Night.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = "UIControl+Night.h"; path = "DKNightVersion/UIKit/UIControl+Night.h"; sourceTree = "<group>"; };
...@@ -1420,7 +1420,7 @@ ...@@ -1420,7 +1420,7 @@
children = ( children = (
A4FA15D44DF6BAC7550EDEED10862AA3 /* AFNetworking */, A4FA15D44DF6BAC7550EDEED10862AA3 /* AFNetworking */,
D49390DC16189A74052FAC3455F18249 /* DKNightVersion.framework */, D49390DC16189A74052FAC3455F18249 /* DKNightVersion.framework */,
51BA97E8B5085EFFB47BC9C0B785CEA7 /* lottie-ios */, 51BA97E8B5085EFFB47BC9C0B785CEA7 /* Lottie.framework */,
1FFED36A657123030ABB700256D73F15 /* Masonry */, 1FFED36A657123030ABB700256D73F15 /* Masonry */,
E49D6D248DD1CEE584E6776B9164A1B2 /* MJRefresh */, E49D6D248DD1CEE584E6776B9164A1B2 /* MJRefresh */,
9BD6F0B21CDAE9FA26016DC870A83047 /* Pods-DreamSleep */, 9BD6F0B21CDAE9FA26016DC870A83047 /* Pods-DreamSleep */,
...@@ -1693,7 +1693,7 @@ ...@@ -1693,7 +1693,7 @@
); );
name = "lottie-ios"; name = "lottie-ios";
productName = Lottie; productName = Lottie;
productReference = 51BA97E8B5085EFFB47BC9C0B785CEA7 /* lottie-ios */; productReference = 51BA97E8B5085EFFB47BC9C0B785CEA7 /* Lottie.framework */;
productType = "com.apple.product-type.framework"; productType = "com.apple.product-type.framework";
}; };
55AF53E6C77A10ED4985E04D74A8878E /* Masonry */ = { 55AF53E6C77A10ED4985E04D74A8878E /* Masonry */ = {
...@@ -1800,7 +1800,7 @@ ...@@ -1800,7 +1800,7 @@
isa = PBXProject; isa = PBXProject;
attributes = { attributes = {
LastSwiftUpdateCheck = 1240; LastSwiftUpdateCheck = 1240;
LastUpgradeCheck = 1240; LastUpgradeCheck = 1330;
}; };
buildConfigurationList = 4821239608C13582E20E6DA73FD5F1F9 /* Build configuration list for PBXProject "Pods" */; buildConfigurationList = 4821239608C13582E20E6DA73FD5F1F9 /* Build configuration list for PBXProject "Pods" */;
compatibilityVersion = "Xcode 13.0"; compatibilityVersion = "Xcode 13.0";
...@@ -2311,7 +2311,7 @@ ...@@ -2311,7 +2311,7 @@
GCC_PREFIX_HEADER = "Target Support Files/lottie-ios/lottie-ios-prefix.pch"; GCC_PREFIX_HEADER = "Target Support Files/lottie-ios/lottie-ios-prefix.pch";
INFOPLIST_FILE = "Target Support Files/lottie-ios/lottie-ios-Info.plist"; INFOPLIST_FILE = "Target Support Files/lottie-ios/lottie-ios-Info.plist";
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 8.0; IPHONEOS_DEPLOYMENT_TARGET = 9.0;
LD_RUNPATH_SEARCH_PATHS = ( LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)", "$(inherited)",
"@executable_path/Frameworks", "@executable_path/Frameworks",
...@@ -2383,7 +2383,7 @@ ...@@ -2383,7 +2383,7 @@
GCC_PREFIX_HEADER = "Target Support Files/lottie-ios/lottie-ios-prefix.pch"; GCC_PREFIX_HEADER = "Target Support Files/lottie-ios/lottie-ios-prefix.pch";
INFOPLIST_FILE = "Target Support Files/lottie-ios/lottie-ios-Info.plist"; INFOPLIST_FILE = "Target Support Files/lottie-ios/lottie-ios-Info.plist";
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 8.0; IPHONEOS_DEPLOYMENT_TARGET = 9.0;
LD_RUNPATH_SEARCH_PATHS = ( LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)", "$(inherited)",
"@executable_path/Frameworks", "@executable_path/Frameworks",
...@@ -2591,7 +2591,7 @@ ...@@ -2591,7 +2591,7 @@
GCC_PREFIX_HEADER = "Target Support Files/lottie-ios/lottie-ios-prefix.pch"; GCC_PREFIX_HEADER = "Target Support Files/lottie-ios/lottie-ios-prefix.pch";
INFOPLIST_FILE = "Target Support Files/lottie-ios/lottie-ios-Info.plist"; INFOPLIST_FILE = "Target Support Files/lottie-ios/lottie-ios-Info.plist";
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 8.0; IPHONEOS_DEPLOYMENT_TARGET = 9.0;
LD_RUNPATH_SEARCH_PATHS = ( LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)", "$(inherited)",
"@executable_path/Frameworks", "@executable_path/Frameworks",
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!