BasicNavigationViewController:UINavigationViwController
/*
隐藏导航底部线条
*/
-(void)viewDidLoad
{
[super viewDidLoad];
self.interactivePopGestureRecognizer.enabled = YES;
/**
* 隐藏导航底部的线条
*/
[self findHairlineFromView:self.navigationBar];
}
- (UIImageView *)findHairlineFromView:(UIView *)view
{
if ([view isKindOfClass:[UIImageView class]] && view.frame.size.height <= 1.0) {
return (UIImageView *)view;
}
for (UIView *subView in view.subviews) {
UIImageView *imageView = [self findHairlineFromView:subView];
imageView.hidden= YES;
if (imageView) {
return imageView;
}
}
return nil;
}
自定义导航控制器push下一个界面的时候的返回按钮
-(void)pushViewController:(UIViewController *)viewController animated:(BOOL)animated
{
if (self.viewControllers.count>0) {
UIButton *backBtn=[DMWidget customButtonWithFrame:CGRectMake(0,0,22, 22) toView:nil];
[backBtn setImage:[UIImage imageNamed:@"icon_返回"] forState:UIControlStateNormal];
[backBtn setImage:[UIImage imageNamed:@"icon_返回"] forState:UIControlStateHighlighted];
//[backBtn setTitle:@"返回" forState:UIControlStateNormal];
// backBtn.titleLabel.font =[UIFont systemFontOfSize:DMFontSize15];
//[backBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
[backBtn addTarget:self action:@selector(backAction) forControlEvents:UIControlEventTouchUpInside];
backBtn.imageEdgeInsets = UIEdgeInsetsMake(0, -5, 0, 5);
viewController.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:backBtn];
}
[super pushViewController:viewController animated:animated];
}
#pragma mark - ---------------- 事件 ------------------
#pragma mark - 返回
- (void)backAction
{
[self popViewControllerAnimated:YES];
}