Comments (4)
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.
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.
@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.
Thanks for the help guys - I was 16 when I asked this time to close this issue 🤣
from crgradientnavigationbar.
Related Issues (12)
- Gradient colors showing as much darker than specified colors HOT 3
- EKEventEditViewController don't work with Gradient
- Double Navigation Bars
- Horizontal gradients? HOT 2
- Modal view HOT 2
- Gradient not showing – only the second color HOT 5
- Allow other directions
- Issue later iOS 7.1
- Loose gradient when screen rotate
- Storyboards? HOT 1
- Totally different if set translucent yes
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from crgradientnavigationbar.