美文网首页
iOS - 导航栏相关

iOS - 导航栏相关

作者: HanZhiZzzzz | 来源:发表于2017-07-19 10:25 被阅读0次

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];

相关文章

网友评论

      本文标题:iOS - 导航栏相关

      本文链接:https://www.haomeiwen.com/subject/wctlkxtx.html