iOS中针对于navigationBar一系列细节设置

以下是关于navigationBar一些细节设置

  1. 去除navigationBar底部的黑线
    [self.navigationController.navigationBar setBackgroundImage:[[UIImage alloc] init] forBarMetrics:UIBarMetricsDefault];
    [self.navigationController.navigationBar setShadowImage:[[UIImage alloc] init]];

2.有时设置navigation的按钮需要对按钮间隔进行设置

    UIButton *but = [UIButton buttonWithType:UIButtonTypeCustom];
    but.frame = CGRectMake(0, 0, 20, 30);
    [but setImage:[UIImage imageNamed:@"page_house_nav_btn_rtn_back"] forState:UIControlStateNormal];
    [but addTarget:self action:@selector(backAC:) forControlEvents:UIControlEventTouchUpInside];
    UIBarButtonItem *bar = [[UIBarButtonItem alloc] initWithCustomView:but];
    UIBarButtonItem *space = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFixedSpace target:nil action:nil];
    space.width = 0;
    self.navigationItem.leftBarButtonItems = [NSArray arrayWithObjects:space, bar, nil];

To Be Continued...

你可能感兴趣的:(iOS中针对于navigationBar一系列细节设置)