导航控制器转换上的iOS黑线

问题描述 投票:2回答:2

当我的视图控制器(导航项中嵌入了大标题和搜索栏)执行推/弹转换时,黑线会短暂显示,如下所示:

enter image description here

我基本上尝试改变所有导航栏颜色相关的东西,但没有任何帮助。

任何帮助,将不胜感激 :)

ios iphone swift uinavigationcontroller uinavigationbar
2个回答
0
投票
extension UINavigationBar {


    var customStyle: NavigationBarCustomStyle {
        set(style) {
            switch style {
            case .clear:
                self.setBackgroundImage(UIImage(), for: .default)
            self.shadowImage = UIImage()
            self.tintColor = .white
            self.isTranslucent = false

                break
            case .bottomLine:
                self.tintColor = .gray
                self.backgroundColor = .yellow
                self.isTranslucent = false
                break
            }
        }
        get {
            return self.customStyle
        }
    }
}

enum NavigationBarCustomStyle {
    case clear
    case bottomLine
//  case white
}

在ViewController >> viewDidLoad方法放在下面的行:

self.navigationController?.navigationBar.customStyle = .clear

0
投票

尝试将导航栏的背景颜色设置为白色(取决于你的情况)为我解决问题,虽然还有另一个小故障,但它更好:)

override func viewDidLoad() {
    super.viewDidLoad()

    self.navigationController?.view.backgroundColor = .white
}
© www.soinside.com 2019 - 2024. All rights reserved.