How to remove UINavigationBar inner shadow in iOS 7?

前端 未结 6 535
深忆病人
深忆病人 2021-02-04 02:01

Inner shadow example

I\'m trying to put nav bar below the other one to make it look like one tall nav bar. But in iOS 7 UINavigationBar now has inner shadow on top and o

6条回答
  •  广开言路
    2021-02-04 02:18

    I had a similar problem, where I wanted to remove the 1px line and the shadow from the navigation bar on iOS7. In my case, I needed a 3 points thick green line at the bottom of the navigation bar.

    If there is a solution to get rid of the 1px line at the bottom of the navigation bar that doesn't involve traversing subviews, I don't know, but there is a way to add a view that hides that line as follows (at least the color of the line can be changed that way).

    UIView * bgView = [[UIView alloc] initWithFrame:CGRectMake(0, navBarHeight, navBarWidth, 1)]; // Dont use magic numbers in your code
    bgView.backgroundColor = //some other color
    [navigationBar addSubview:bgView];
    [navigationBar setShadowImage:nil];
    

提交回复
热议问题