swift-设置导航栏的背景颜色,及清除导航栏底部线条

2017-09-15  本文已影响0人  KUANGJUNJIE
 func setNavigationUI() {
        // 纯色生成一张图片
        let image = MeiDuiImageUtility.image(with: #colorLiteral(red: 0.9529411765, green: 0.6588235294, blue: 0.007843137255, alpha: 1), size: CGSize(width: ScreenWidth, height: 64))
        // 设置导航栏背景图片
        self.navigationController?.navigationBar.setBackgroundImage(image, for: .default)
        // 设置标题的颜色
        self.navigationController?.navigationBar.titleTextAttributes = [NSForegroundColorAttributeName:#colorLiteral(red: 1, green: 1, blue: 1, alpha: 1)]
        // 设置导航栏的透明度
        self.navigationController?.navigationBar.isTranslucent = false
        // 设置导航栏底部线条
        self.navigationController?.navigationBar.shadowImage = UIImage()
        // 设置状态栏的状态
        UIApplication.shared.statusBarStyle = .lightContent
    }
上一篇下一篇

猜你喜欢

热点阅读