简体   繁体   English

隐藏导航控制器栏后的黑线

[英]Black line after hiding Navigation Controller Bar

I created my navigation controller programmatically, without storyboard and .nib. 我以编程方式创建了我的导航控制器,没有情节提要和.nib。 I needed to hide it so I used 我需要隐藏它,所以我用了

[navigationController setNavigationBarHidden:YES]; 

in applicationDidFinishLaunchingWithOptions: . applicationDidFinishLaunchingWithOptions: It looks fine on my root screen but at the top of the second view controller there is a black line at the place of the navigation bar which covers some of my button. 在我的根屏幕上看起来还不错,但是在第二个视图控制器的顶部,导航栏的位置有一条黑线覆盖了我的某些按钮。

Can someone please explain to me what this is and how I can delete it? 有人可以告诉我这是什么以及如何删除它吗?

You should set a custom shadow image and use it behind. 您应该设置一个自定义阴影图像并在后面使用它。

From Apple documentation: 从Apple文档中:

For a custom shadow image to be shown, a custom background image must also be set with the setBackgroundImage:forBarMetrics: method. 为了显示自定义阴影图像,还必须使用setBackgroundImage:forBarMetrics:方法设置自定义背景图像。 If the default background image is used, then the default shadow image will be used regardless of the value of this property. 如果使用默认的背景图像,则无论此属性的值如何,都将使用默认的阴影图像。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM