iOS7 - Change UINavigationBar border color

后端 未结 15 2075
时光取名叫无心
时光取名叫无心 2020-12-07 14:44

Is it possible to change the grey border-bottom color of the UINavigationBar in iOS7?

I already tried to remove to border, but this is not working:

[         


        
15条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-07 15:26

    If you like simple and hacky solutions like I do, create a view that covers the default border:

    UIView *navBarLineView = [[UIView alloc] initWithFrame:CGRectMake(0, CGRectGetHeight(self.navigationController.navigationBar.frame),
                                                                      CGRectGetWidth(self.navigationController.navigationBar.frame), 1)];
    navBarLineView.backgroundColor = [UIColor redColor];
    [self.navigationController.navigationBar addSubview:navBarLineView];
    

提交回复
热议问题