美文网首页
自定义导航栏标题,解决导航栏透明状态下有一条线

自定义导航栏标题,解决导航栏透明状态下有一条线

作者: 吃货_X | 来源:发表于2017-08-25 18:11 被阅读6次
UILabel *title = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 200, 44)];
    title.text = @"商家";
    title.font = FONT(36);
    title.textAlignment = NSTextAlignmentCenter;
    title.textColor = COLOR(whiteColor);
    self.navigationItem.titleView = title;//以此类推,这儿也可以是分段控制器或者其他。(我没试过!)

[self.navigationController.navigationBar setBackgroundImage:[UIImage new] forBarMetrics:UIBarMetricsDefault];
    self.navigationController.navigationBar.shadowImage =  [UIImage new];//这儿就是去掉那条线。在设置线为空时必须先设置背景图(开始不知道,哎!)

相关文章

网友评论

      本文标题:自定义导航栏标题,解决导航栏透明状态下有一条线

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