我想让状态栏保持半透明状态,以便它与app中的背景图像不同
我尝试使用此代码
override func preferredStatusBarStyle() -> UIStatusBarStyle {
return UIStatusBarStyle.LightContent
}
我需要状态栏,但它应该是半透明的。
导航栏我在didload中使用了这个
self.navigationController?.navigationBarHidden = false // Show navigationbar.
self.navigationItem.leftItemsSupplementBackButton = true // To add back button.
self.navigationController?.navigationBar.topItem!.title = "" // set nav bar title
self.navigationController?.navigationBar.backItem?.title = "" //set back button text
self.navigationController?.navigationBar.tintColor = UIColor(red: 0 / 255.0, green: 94 / 255.0, blue: 245 / 255.0, alpha: 1.0)
// setting navigation bar translucent background need 3 lines of code
self.navigationController?.navigationBar.setBackgroundImage(UIImage(), forBarMetrics: .Default)
self.navigationController?.navigationBar.shadowImage = UIImage()
self.navigationController?.navigationBar.translucent = true
任何猜测我都在使用模拟器。
答案 0 :(得分:0)
找到以下步骤:
1. Select Navigation bar from Navigation Controller
2. Open Attribute inspector for selected navigation bar and set its bar tint as Clear Color
答案 1 :(得分:0)
答案 2 :(得分:-2)
UIApplication.shared.statusBarView?.backgroundColor = .clear