GiGaMaskTime/GIGA/Common/BaseVC/GiGaBaseNavViewController.m

69 lines
2.0 KiB
Objective-C

//
// GiGaBaseNavViewController.m
// GIGA
//
// Created by lianxiang on 2018/8/13.
// Copyright © 2018年 com.giga.ios. All rights reserved.
//
#import "GiGaBaseNavViewController.h"
@interface GiGaBaseNavViewController ()<UINavigationControllerDelegate>
@end
@implementation GiGaBaseNavViewController
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
self.interactivePopGestureRecognizer.delegate = (id)self;
self.view.backgroundColor = UIColor.whiteColor;
}
-(UIStatusBarStyle)preferredStatusBarStyle
{
return UIStatusBarStyleDefault;
}
-(void)pushViewController:(UIViewController *)viewController animated:(BOOL)animated
{
if (self.viewControllers.count > 0) {
viewController.hidesBottomBarWhenPushed = YES;
}
[super pushViewController:viewController animated:animated];
if (self.viewControllers.count > 1 ) {
//自定义返回按钮
UIButton *backBtn = [UIButton buttonWithType:UIButtonTypeCustom];
[backBtn setImage:[UIImage imageNamed:@""] forState:UIControlStateNormal];
backBtn.backgroundColor = [UIColor redColor];
[backBtn addTarget:self action:@selector(backItemAction) forControlEvents:UIControlEventTouchUpInside];
UIBarButtonItem *backItem = [[UIBarButtonItem alloc] initWithCustomView:backBtn];
viewController.navigationItem.leftBarButtonItem = backItem;
}
}
-(void)backItemAction{
[super popViewControllerAnimated:YES];
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
/*
#pragma mark - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
// Get the new view controller using [segue destinationViewController].
// Pass the selected object to the new view controller.
}
*/
@end