gpt4 book ai didi

ios - UINavigationBar 不延伸到状态栏后面

转载 作者:行者123 更新时间:2023-11-28 21:35:48 25 4
gpt4 key购买 nike

我觉得我完全忽略了一些东西,因为这是非常基本的。

在一个完全简单的设置中:

window = UIWindow(frame: UIScreen.mainScreen().bounds)
window.backgroundColor = UIColor.whiteColor()

let rootController = MainViewController()
rootNavigationController = UINavigationController(rootViewController: rootController)

window.rootViewController = rootNavigationController;
window.makeKeyAndVisible()

// Appearance
UINavigationBar.appearance().barTintColor = UIColor.DailyRate.blueColor
UINavigationBar.appearance().titleTextAttributes = [NSForegroundColorAttributeName: UIColor.whiteColor()]
UINavigationBar.appearance().opaque = false

我得到一个导航栏,它延伸到状态后面,这应该是默认行为。

enter image description here

最佳答案

我刚刚试过了,我得到了正确的结果。请找到我的完整代码。我在您的代码中找不到一些东西(我不明白您所说的 DailyRate 是什么意思),其余的东西与您的代码相同。

var window: UIWindow?
var rootNavigationController : UINavigationController?

func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {


window = UIWindow(frame: UIScreen.mainScreen().bounds)
window!.backgroundColor = UIColor.whiteColor()

let rootController = ViewController()
rootNavigationController = UINavigationController(rootViewController: rootController)

window!.rootViewController = rootNavigationController;
window!.makeKeyAndVisible()

// Appearance
UINavigationBar.appearance().barTintColor = UIColor.blueColor()
UINavigationBar.appearance().titleTextAttributes = [NSForegroundColorAttributeName: UIColor.whiteColor()]
UINavigationBar.appearance().opaque = false

// Override point for customization after application launch.
return true
}

结果在下面的附件中。 enter image description here

关于ios - UINavigationBar 不延伸到状态栏后面,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33970030/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com