iOS - 导航栏相关

2017-07-19  本文已影响0人  HanZhiZzzzz

1:隐藏导航栏下面的线

 [self.navigationController.navigationBar setBackgroundImage:[UIImage new] forBarMetrics:UIBarMetricsDefault];
 //消除阴影
 self.navigationController.navigationBar.shadowImage = [UIImage new];

调整导航栏按钮间距

    UIBarButtonItem *fixedButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFixedSpace target:nil action:nil];
    fixedButton.width = -15;
    
    UIButton *rightBtn = MakeTextButtonWith(17, BlackColor, @"我的文件", kClearColor);
    CGFloat litleMargin  = (Px30Distance);
    [rightBtn addTarget:self action:@selector(rightBtnClick) forControlEvents:UIControlEventTouchUpInside];
    CGFloat rightBtnW = (WidthOfLabel(Pt15FontSize, @"我的文件") +litleMargin * 2);
    rightBtn.frame = CGRM(kScreenWidth - rightBtnW - Px30Distance + litleMargin, 20, rightBtnW, 44);
    UIBarButtonItem *rightBarButtonItem = [[UIBarButtonItem alloc]initWithCustomView:rightBtn];
    self.navigationItem.rightBarButtonItems = @[fixedButton ,rightBarButtonItem];
上一篇 下一篇

猜你喜欢

热点阅读