gpt4 book ai didi

iOS popViewController 出现动画黑条

转载 作者:搜寻专家 更新时间:2023-11-01 07:33:36 26 4
gpt4 key购买 nike

我有两个 View Controller 。第一个 View Controller 没有状态栏。

class ViewController: UIViewController {

override func prefersStatusBarHidden() -> Bool {
return true
}

}

另外,我在 Info.plist 中将 UIViewControllerBasedStatusBarAppearance 设置为 YES。

第二个 View Controller 有状态栏。

class SecondViewController: UIViewController {

override func prefersStatusBarHidden() -> Bool {
return false
}
}

他们之间的关系是一个推送segue。

enter image description here

最后一件事是我在 application:didFinishLaunchingWithOptions: 方法中将 translucent 属性设置为 false。

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

UINavigationBar.appearance().translucent = false
UINavigationBar.appearance().barTintColor = UIColor.redColor()

return true
}

当我在导航栏中单击返回时,有一个黑条。如何摆脱它?当我将 translucent 设置为 true 时,黑条消失了。

enter image description here

最佳答案

看完帖子后Explaining difference between automaticallyAdjustsScrollViewInsets, extendedLayoutIncludesOpaqueBars, edgesForExtendedLayout in iOS7 ,我想出了一个解决办法。

extendedLayoutIncludesOpaqueBars 设置为 true。

func viewDidLoad() {
extendedLayoutIncludesOpaqueBars = true // property introduced in iOS7,default value is false
}

关于iOS popViewController 出现动画黑条,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31209225/

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