Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Has anyone managed to add this on a navigation bar? #19

Open
LarsWith opened this issue Jun 1, 2017 · 0 comments
Open

Has anyone managed to add this on a navigation bar? #19

LarsWith opened this issue Jun 1, 2017 · 0 comments

Comments

@LarsWith
Copy link

LarsWith commented Jun 1, 2017

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.

  1. 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.

  2. If I hide the navigation bar on scroll, the navigation bar will get hidden but not the gradient view

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant