iOS7导航条

iOS7导航条置透明并去黑线:

在导航条创建时,调用此方法

- (void)_configNavgationBar
{

    /图片为640x128的透明png图片
    [self.rootNav.navigationBar setBackgroundImage:[UIImage imageNamed:@"sw_navigatonBg.png"]
                                                  forBarMetrics:UIBarMetricsDefault];
    [[UINavigationBar appearance] setShadowImage:[UIImage imageNamed:@"sw_navigatonBg.png"]]; //去黑线

}


iOS7导航条返回按钮与系统手势问题

 UIButton *backButton = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 22, 22)];
    [backButton setBackgroundImage:[UIImage imageNamed:@"back.png"]
                          forState:UIControlStateNormal];
    backButton.backgroundColor = [UIColor clearColor];
    [backButton addTarget:self action:@selector(back) forControlEvents:UIControlEventTouchUpInside];
    
    UIBarButtonItem *item = [[UIBarButtonItem alloc] initWithCustomView:backButton];
    self.navigationItem.leftBarButtonItem = item;

在rootVC的viewWillAppear里,调用,禁用手势

self.navigationController.interactivePopGestureRecognizer.enabled = NO;


在push chilldVC时打开手势
     if ([self.navigationController respondsToSelector:@selector(interactivePopGestureRecognizer)]) { self.navigationController.interactivePopGestureRecognizer.enabled = YES; self.navigationController.interactivePopGestureRecognizer.delegate = nil; }


你可能感兴趣的:(iOS7导航条)