IOS remove the navigation bar and tabbar 1px line

1 in their own definition of the navigation bar or design draft often need to remove the navigation bar 1px line, mainly the color is too uncoordinated

IOS remove the navigation bar and tabbar 1px line
before removal of the picture

To remove this 1px horizontal line, first of all should know what it is, in the Xcode interface debugging can be seen, it is actually UIImageView

IOS remove the navigation bar and tabbar 1px line
find out what the horizontal line is…

In fact, this is the navigationBar of shadowImage, so as long as it is set to empty, but it should be set before it is empty to set its background is empty, all the code is as follows:

[self.navigationController.navigationBar setBackgroundImage:[UIImage new] forBarMetrics:UIBarMetricsDefault]; [self.navigationController.navigationBar setShadowImage:[UIImage new]];

The results are as follows (is it all?) :

IOS remove the navigation bar and tabbar 1px line
after the completion of the effect

Since the navigation bar of the horizontal line can be removed, the tabbar that line is also able to remove the (in fact, is also shadowImage)

One method:

Custom UITabBarController

Method two:

[self.tabBarController.tabBar setBackgroundImage:[UIImage new]]; [self.tabBarController.tabBar setShadowImage:[UIImage new]];

On the other hand, if we want to customize the color of the line is also possible, as long as it can be set up shadowImage. If there is a better way, I hope to exchange ~ ~ ~)