BaseNavigationViewController
#import "BaseNavigationViewController.h"
@interface BaseNavigationViewController ()<UINavigationControllerDelegate>
@end
@implementation BaseNavigationViewController
- (void)viewDidLoad {
[super viewDidLoad];
self.delegate = self;
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
-(void)navigationController:(UINavigationController *)navigationController willShowViewController:(UIViewController *)viewController animated:(BOOL)animated {
if (self.viewControllers.count > 1) {
_leftButton = [UIButton buttonWithType:UIButtonTypeCustom];
[_leftButton setBackgroundImage:[UIImage imageNamed:@"user_icon_arrow_left_red"] forState:UIControlStateNormal];
_leftButton.frame = CGRectMake(0, 0, 24, 20);
[_leftButton addTarget:self action:@selector(backAction) forControlEvents:UIControlEventTouchUpInside];
UIBarButtonItem *left = [[UIBarButtonItem alloc ] initWithCustomView:_leftButton];
viewController.navigationItem.leftBarButtonItem = left;
}
}
- (void)navigationController:(UINavigationController *)navigationController didShowViewController:(UIViewController *)viewController animated:(BOOL)animated {
if (self.viewControllers.count > 1) {
self.interactivePopGestureRecognizer.delegate = (id)viewController;
}
}
-(void)backAction
{
[self popViewControllerAnimated:YES];
}

浙公网安备 33010602011771号