[英]Im having trouble with using a custom navigation bar in SWIFT
Im making an app that has a login screen and when I log in my custom navigation bar works fine and has the proper image but after i close the app and reopen the navigation bar is the default white color. 我正在制作一个具有登录屏幕的应用程序,当我登录自己的自定义导航栏时可以正常工作并具有正确的图像,但是在我关闭该应用程序并重新打开后,导航栏为默认的白色。 Any ideas on how to fix this? 有想法该怎么解决这个吗?
let navBackgroundImage:UIImage! = UIImage(named: "navbar_bg")
[UINavigationBar .appearance().setBackgroundImage(navBackgroundImage, forBarMetrics:.Default)]
Use this code to set image for navigation bar: 使用以下代码设置导航栏的图像:
let image = UIImage(named: "navbar_bg")
self.navigationController!.navigationBar.setBackgroundImage(image,forBarMetrics: .Default)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.