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

2017-08-25  本文已影响6人  吃货_X
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];//这儿就是去掉那条线。在设置线为空时必须先设置背景图(开始不知道,哎!)
上一篇 下一篇

猜你喜欢

热点阅读