更新自定义导航栏透明图像自动布局Iphone X?
Update custom navigationBar trasparent Image autolayout Iphone X?
告诉我怎么做自定义导航栏透明Iphone X?这是我想要的图片。这是我所做的代码。但是当我修复图片时,这些变化并没有发生。透明的导航栏和状态栏变为 ordinary.All 我的数据已移动,我已修复。
告诉我您还需要添加什么以便我也拥有它?
my code : ViewController
override func viewDidLoad() {
super.viewDidLoad()
UIApplication.shared.statusBarStyle = .default
// Do any additional setup after loading the view.
}
AppDelegate.swift
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
UINavigationBar.appearance().setBackgroundImage(UIImage(), for: .default)
// Sets shadow (line below the bar) to a blank image
UINavigationBar.appearance().shadowImage = UIImage()
// Sets the translucent background color
UINavigationBar.appearance().backgroundColor = UIColor(red: 0.0, green: 0.0, blue: 0.0, alpha: 0.0)
// Set translucent. (Default value is already true, so this can be removed if desired.)
UINavigationBar.appearance().isTranslucent = true
// Override point for customization after application launch.
UITabBar.appearance().tintColor = UIColor(red:1.00, green:0.88, blue:0.00, alpha:1.0)
UITabBar.appearance().barTintColor = UIColor.black
UIApplication.shared.statusBarStyle = .lightContent
}
enter image description here
enter image description here
您还需要将 UIStatusBarStyle
键添加到 Info.plist 并将值设置为 .lightContent
告诉我怎么做自定义导航栏透明Iphone X?这是我想要的图片。这是我所做的代码。但是当我修复图片时,这些变化并没有发生。透明的导航栏和状态栏变为 ordinary.All 我的数据已移动,我已修复。 告诉我您还需要添加什么以便我也拥有它?
my code : ViewController
override func viewDidLoad() {
super.viewDidLoad()
UIApplication.shared.statusBarStyle = .default
// Do any additional setup after loading the view.
}
AppDelegate.swift
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
UINavigationBar.appearance().setBackgroundImage(UIImage(), for: .default)
// Sets shadow (line below the bar) to a blank image
UINavigationBar.appearance().shadowImage = UIImage()
// Sets the translucent background color
UINavigationBar.appearance().backgroundColor = UIColor(red: 0.0, green: 0.0, blue: 0.0, alpha: 0.0)
// Set translucent. (Default value is already true, so this can be removed if desired.)
UINavigationBar.appearance().isTranslucent = true
// Override point for customization after application launch.
UITabBar.appearance().tintColor = UIColor(red:1.00, green:0.88, blue:0.00, alpha:1.0)
UITabBar.appearance().barTintColor = UIColor.black
UIApplication.shared.statusBarStyle = .lightContent
}
enter image description here
enter image description here
您还需要将 UIStatusBarStyle
键添加到 Info.plist 并将值设置为 .lightContent