修改navigationbar 背景(去除横线)和字体颜色

//在 AppDelegate.h中写方法


func setNavigationBarStyle() ->Void{

        var bgImage = UIImage(named: "导航矩形3x.png")?.resizableImage(withCapInsets:  UIEdgeInsets(), resizingMode: .stretch)

        UINavigationBar.appearance().setBackgroundImage(bgImage, for: .default)

        //设置navigationbar 压缩图片后出现横线,通过此方法消除横线阴影

        UINavigationBar.appearance().shadowImage = UIImage()

        

        UINavigationBar.appearance().tintColor = UIColor.white

        UINavigationBar.appearance().barTintColor = UIColor.white

        UINavigationBar.appearance().titleTextAttributes = [NSAttributedStringKey.foregroundColor: UIColor.white] //设置title颜色

扫描二维码关注公众号,回复: 2460371 查看本文章

    }

猜你喜欢

转载自blog.csdn.net/talinboy/article/details/79281704