GithubHelp home page GithubHelp logo

Comments (4)

levibostian avatar levibostian commented on May 7, 2024 1

I ended up solving the issue that I needed. After checking out this pull request, I pulled down the master branch of the pull request and ran the demo and learned:

UIColor *firstColor = [UIColor colorWithRed:255.0f/255.0f green:42.0f/255.0f blue:104.0f/255.0f alpha:1.0f];
UIColor *secondColor = [UIColor colorWithRed:255.0f/255.0f green:90.0f/255.0f blue:58.0f/255.0f alpha:1.0f];
NSArray *colors = [NSArray arrayWithObjects:firstColor, secondColor, nil];

CRGradientNavigationBar *bar = (CRGradientNavigationBar *)self.navigationController.navigationBar;
    [bar setBarTintGradientColors:colors];

instead of:

[[CRGradientNavigationBar appearance] setBarTintColors:colors];

Thank you

from crgradientnavigationbar.

christianroman avatar christianroman commented on May 7, 2024

if you want to change the colour dynamically for only one View Controller you can use:

[[CRGradientNavigationBar appearance] setBarTintColors:colors];

This also works with an UINavigationBar IBOutlet (w/o an UINavigationController):
Place a navigation bar onto your view in IB. In IB set the navigation bar class to CRGradientNavigationBar (Same steps if you are using Storyboards). http://stackoverflow.com/questions/19174542/initwithnavigationbarclass-for-uinavigationcontroller-in-a-storyboard-applicatio

Also, if you choose to use a Navigation Controller (as the example). Hide the bar on the first screen, show the bar on the second screen or something like this using the viewWillAppear: and viewWilDisappear: methods of your UIViewController as a good place to control the visibility of the navigation controller's bar.

Hope it helps.

from crgradientnavigationbar.

levibostian avatar levibostian commented on May 7, 2024

@chroman, with my experience, this is not 100% dynamic. If I call [[CRGradientNavigationBar appearance] setBarTintColors:colors]; after I call [[CRGradientNavigationBar appearance] setBarTintGradientColors:colors]; it stays on the gradient and does not go to a flat color.

Any way to get this to work?

from crgradientnavigationbar.

prnk28 avatar prnk28 commented on May 7, 2024

Thanks for the help guys - I was 16 when I asked this time to close this issue 🤣

from crgradientnavigationbar.

Related Issues (12)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.