How can I set the UINavigationbar with gradient color?

前端 未结 11 707
花落未央
花落未央 2020-11-30 22:27

I want to set the UINavigationbar backgroundColor to a gradient color where I would like to set it via an array of colors to create a Gradient, ide

11条回答
  •  -上瘾入骨i
    2020-11-30 23:13

    This is a framework for different UI components gradient include UINavigation bar: enter link description here

    first : then in your root ViewController that it embedded into an UINavigationController

    import SHNDStuffs
    

    put this in your ViewDidLoad()

    class RootViewController: UIViewController {
        override func viewDidLoad() {
            super.viewDidLoad()
    
            SHNDNavigationBarGradient(firstColor: .darkGray,
                                      secondColor: .white,
                                      tintColor: .black,
                                      isHorizontal: true)
    }
    

提交回复
热议问题