Files
yinmeng-ios/xplan-ios/Base/UI/BaseNavigationController.m

57 lines
1.9 KiB
Mathematica
Raw Normal View History

2021-09-07 23:05:43 +08:00
//
// BaseNavigationController.m
// xplan-ios
//
// Created by zu on 2021/9/7.
//
#import "BaseNavigationController.h"
///Tool
#import "ThemeColor.h"
2021-09-07 23:05:43 +08:00
@interface BaseNavigationController ()
@end
@implementation BaseNavigationController
- (void)viewDidLoad {
[super viewDidLoad];
[self themeConfig];
}
2021-09-09 19:18:47 +08:00
- (void)pushViewController:(UIViewController *)viewController animated:(BOOL)animated {
2021-09-16 17:21:52 +08:00
if(self.topViewController == viewController) return;
if (self.childViewControllers.count > 0) {
viewController.hidesBottomBarWhenPushed = YES;
}
2021-09-09 19:18:47 +08:00
viewController.navigationItem.backBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"" style:UIBarButtonItemStylePlain target:nil action:nil];
2021-09-16 17:21:52 +08:00
2021-09-09 19:18:47 +08:00
[super pushViewController:viewController animated:animated];
}
2021-09-07 23:05:43 +08:00
- (void)themeConfig {
self.navigationBar.shadowImage = [[UIImage alloc] init];
self.navigationBar.barTintColor = [ThemeColor appBackgroundColor];
2021-09-07 23:05:43 +08:00
self.navigationBar.tintColor = [UIColor whiteColor];
self.navigationBar.translucent = NO;
[self.navigationBar setTitleTextAttributes:@{
2021-09-09 19:18:47 +08:00
NSFontAttributeName:[UIFont systemFontOfSize:18 weight:UIFontWeightMedium],
2021-09-07 23:05:43 +08:00
NSForegroundColorAttributeName:UIColor.whiteColor
}];
/// scrollEdgeAppearance iOS15 nil 使 standardAppearance使 @fengshuo
if (@available(iOS 15.0, *)) {
UINavigationBarAppearance *appearance = [UINavigationBarAppearance new];
appearance.titleTextAttributes = @{NSFontAttributeName:[UIFont systemFontOfSize:18 weight:UIFontWeightMedium],
NSForegroundColorAttributeName:UIColor.whiteColor};
appearance.backgroundColor = [ThemeColor appBackgroundColor];
self.navigationBar.standardAppearance = appearance;
self.navigationBar.scrollEdgeAppearance = appearance;
}
2021-09-07 23:05:43 +08:00
}
2021-09-07 23:05:43 +08:00
@end