123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100 |
- //
- // ZCBaseNavigationVC.m
- // HuaKaiChat
- //
- // Created by 张灿 on 2017/6/27.
- // Copyright © 2017年 huakai. All rights reserved.
- //
- #import "ZCBaseNavigationVC.h"
- #import "UIBarButtonItem+Extension.h"
- //#import "ZCNavigationBar.h"
- @interface ZCBaseNavigationVC ()
- @end
- @implementation ZCBaseNavigationVC
- + (void)initialize{
- [self navTheme];
- [self itemTheme];
- }
- + (void)navTheme{
- UINavigationBar *navBar = [UINavigationBar appearance];
- //去掉navigationbar的半透明度//
- navBar.translucent = NO;
- navBar.shadowImage = [UIImage new];
- [navBar setBackgroundImage:[UIImage imageWithColor:[UIColor whiteColor] size:CGSizeMake(KScreenWidth, NavBarHeight)] forBarMetrics:UIBarMetricsDefault];
- [navBar setBarTintColor:[UIColor whiteColor]];
- navBar.tintColor = LZ273145Color;
- NSMutableDictionary *textAttrs = [NSMutableDictionary dictionary];
- textAttrs[NSForegroundColorAttributeName] = LZ273145Color;
- textAttrs[NSFontAttributeName] = LCBFont17;
- [navBar setTitleTextAttributes:textAttrs];
- [LCTools getImageUrlWithAddress:@""];
- if (@available(iOS 15.0, *)) {
- UINavigationBarAppearance *appearance = [[UINavigationBarAppearance alloc] init];
- appearance.backgroundEffect = [UIBlurEffect effectWithStyle:UIBlurEffectStyleRegular];
- [appearance setBackgroundImage:[UIImage imageWithColor:[UIColor whiteColor] size:CGSizeMake(KScreenWidth, NavBarHeight)]];
- appearance.backgroundEffect = nil;
- appearance.shadowColor = [UIColor clearColor];
- NSMutableDictionary *textAttrs = [NSMutableDictionary dictionary];
- textAttrs[NSForegroundColorAttributeName] = LZ273145Color;
- appearance.titleTextAttributes = textAttrs;
- navBar.scrollEdgeAppearance = appearance;
- navBar.standardAppearance = appearance;
- }
- }
- + (void)itemTheme{
- UIBarButtonItem *item = [UIBarButtonItem appearance];
- NSMutableDictionary *textAttrs = [NSMutableDictionary dictionary];
- textAttrs[NSForegroundColorAttributeName] = LZ273145Color;
- textAttrs[NSFontAttributeName] = LCFont17;
- [item setTitleTextAttributes:textAttrs forState:UIControlStateNormal];
- }
- - (void)viewDidLoad{
- [super viewDidLoad];
-
- self.interactivePopGestureRecognizer.delegate = nil;
-
- // self.navigationBar.frame = CGRectMake(0, 0,KScreenWidth, NAVIGATION_HEIGHT);
- //#ifdef __IPHONE_11_0
- //
- // if (@available(iOS 11.0, *)) {
- //
- // self.navigationBar.frame = CGRectMake(0, STATUSBAR_HEIGHT,KScreenWidth, NAVIGATION_HEIGHT);
- //
- // }
- //
- //#endif
- }
- //push的时候,是否保留下方的tabBar判断方法
- - (void)pushViewController:(UIViewController *)viewController animated:(BOOL)animated{
- if (self.viewControllers.count > 0) { // 如果push的不是根控制器(不是栈底控制器)
- viewController.hidesBottomBarWhenPushed = YES;
- // viewController.navigationItem.leftBarButtonItem = [UIBarButtonItem itemWithImage:@"nav_back_normal" title:nil highImage:@"nav_back_normal" contentEdge:UIEdgeInsetsMake(12, -20, 12, 27) target:self action:@selector(back)];
- viewController.navigationItem.leftBarButtonItem = [UIBarButtonItem itemWithTarget:self action:@selector(back) image:[UIImage imageNamed:@"vqu_images_navigation_back_black"]];
- }
- [super pushViewController:viewController animated:animated];
-
- }
- - (void)back{
-
- [self popViewControllerAnimated:YES];
- }
- - (UIViewController *)childViewControllerForStatusBarStyle{
- return self.topViewController;
- }
- @end
|