Has anyone managed to add this on a navigation bar?
LarsWith opened this issue · comments
Has anyone managed to add this on a navigation bar?
I am trying to add this to my navigation bar, so far I have tried this:
let pastelView = PastelView(frame: (navigationController?.navigationBar.bounds)!)
pastelView.startPoint = .bottomLeft
pastelView.endPoint = .topRight
pastelView.animationDuration = 3.0
pastelView.setColors(colors: [UIColor(red: 156/255, green: 39/255, blue: 176/255, alpha: 1.0),
UIColor(red: 255/255, green: 64/255, blue: 129/255, alpha: 1.0),
UIColor(red: 123/255, green: 31/255, blue: 162/255, alpha: 1.0),
UIColor(red: 32/255, green: 76/255, blue: 255/255, alpha: 1.0),
UIColor(red: 32/255, green: 158/255, blue: 255/255, alpha: 1.0),
UIColor(red: 90/255, green: 120/255, blue: 127/255, alpha: 1.0),
UIColor(red: 58/255, green: 255/255, blue: 217/255, alpha: 1.0)])
pastelView.startAnimation()
self.navigationController?.view.addSubview(pastelView)
This will add the gradietn view to my navigation bar, but there is two problems.
-
it will place it self at the very top over my status bar, and since the status bar is 20 - 25px in height it will be 20 - 25px too short at the bottom.
-
If I hide the navigation bar on scroll, the navigation bar will get hidden but not the gradient view