// // XMGOpenGLNavVc.m // XMGOpenGLDrawPanel // // Created by wei zeng on 2019/5/7. // Copyright © 2019 wei zeng. All rights reserved. // #import "XMGOpenGLNavVc.h" @interface XMGOpenGLNavVc () @end @implementation XMGOpenGLNavVc + (void)initialize{ UIImage *bg = [UIImage imageNamed:@"navigationbarBackgroundWhite8"]; UINavigationBar *bar = [UINavigationBar appearance]; [bar setTintColor:[UIColor whiteColor]]; [bar setBackgroundImage:bg forBarMetrics:UIBarMetricsDefault]; [bar setBackgroundColor:[UIColor whiteColor]]; [bar setTitleTextAttributes:@{NSFontAttributeName : [UIFont systemFontOfSize:15 weight:UIFontWeightRegular]}]; UIFont *font = [UIFont systemFontOfSize:15 weight:UIFontWeightRegular]; NSDictionary *textAttributes = @{ NSFontAttributeName : font, NSForegroundColorAttributeName : [UIColor blackColor] }; [[UINavigationBar appearance] setTitleTextAttributes:textAttributes]; [[UINavigationBar appearance] setTintColor:[UIColor blackColor]]; [[UINavigationBar appearance] setBarTintColor:kRGBColor(255, 255, 255)]; } //-(void)viewDidLoad{ // [super viewDidLoad]; // // if ([self respondsToSelector:@selector(interactivePopGestureRecognizer)]) { // self.interactivePopGestureRecognizer.enabled = NO; // } //} - (void)pushViewController:(UIViewController *)viewController animated:(BOOL)animated { if (self.childViewControllers.count) { viewController.hidesBottomBarWhenPushed = YES; UIButton *button = [[UIButton alloc] init]; [button setImage:[UIImage imageNamed:@"navigationButtonReturn"] forState:UIControlStateNormal]; [button setImage:[UIImage imageNamed:@"navigationButtonReturnClick"] forState:UIControlStateHighlighted]; button.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft; //[button setTitle:@"返回" forState:UIControlStateNormal]; [button setTitleColor:[UIColor blackColor] forState:UIControlStateNormal]; [button setTitleColor:[UIColor redColor] forState:UIControlStateHighlighted]; [button addTarget:self action:@selector(back) forControlEvents:UIControlEventTouchUpInside]; button.bounds = CGRectMake(0, 0, 30, 44); //[button sizeToFit]; //button.contentEdgeInsets = UIEdgeInsetsMake(0, -5, 0, 0); button.titleLabel.font = [UIFont systemFontOfSize:15]; viewController.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:button]; } [[NSNotificationCenter defaultCenter] postNotificationName:@"hidddenBottomView" object:nil userInfo:@{@"jxmessage":@"1",@"my":@"1",@"gif":@"1"}]; // [[NSNotificationCenter defaultCenter] postNotificationName:@"hidddenShowBottomView" object:nil]; viewController.hidesBottomBarWhenPushed=YES; [super pushViewController:viewController animated:animated]; NSLog(@"aaaa %zd",self.childViewControllers.count); } -(void)back{ [self popViewControllerAnimated:YES]; } @end