Reputation: 128
project sdk version: ios > 7.0
FITST: I want user 'CRGradientNavigationBar
' in my project.. but i use storyboard layout...
LINK: CRGradientNavigationBar
The effect can not be achieved CRGradientNavigationBar
..
So, please help me ......
NSArray *colors = [NSArray arrayWithObjects:(id)UIColorFromRGB(0xf16149).CGColor, (id)UIColorFromRGB(0xf14959).CGColor, nil];
[[CRGradientNavigationBar appearance] setBarTintGradientColors:colors];
'is something wrong ??'**
Upvotes: 0
Views: 279
Reputation: 513
To use CRGradientNavigationBar in a Storyboard, you could do the followings 2 things:
1) Create/ Embed a Navigation Controller in your Storyboard. Then go the left side menu (Document Outline) select Navigation Bar on the just created Navigation Controller and then on the right Menu on the Identity Inspector go to Custom Class and use: CRGradientNavigationBar. For the last thing, make sure that you have selected the NavigationController.
https://i.sstatic.net/PVFOQ.jpg
2) In your ViewController use for example:
- (void)viewDidLoad
{
[super viewDidLoad];
NSArray *colors = [NSArray arrayWithObjects:(id)[UIColor redColor].CGColor, (id)[UIColor orangeColor].CGColor, nil];
[(CRGradientNavigationBar *)[self.navigationController navigationBar] setBarTintGradientColors:colors];
}
Upvotes: 2