I'm having trouble setting a gradient as the background to my UINaviagtionBar. I've created a class that handles the CAGradientLayer which seems to be fine until I set the gradient to the navigation bar's layer. The buttons and the title fade away once i start going through the stacks and even going back to the topContorller ("Settings" View) the title becomes faded as well.
Here is my code I'm running on the "Settings" view
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
CAGradientLayer * randomLayer = [Gradient gold];
randomLayer.frame = CGRectMake(0, -20, self.navigationController.navigationBar.frame.size.width, self.navigationController.navigationBar.frame.size.height + 20);
[randomLayer setStartPoint:CGPointMake(0.0, 0.5)];
[randomLayer setEndPoint:CGPointMake(1.0, 0.5)];
[self.navigationController.navigationBar.layer insertSublayer:randomLayer atIndex:1];
}
maybe there's a way to bring the NavigationBarItems to the front of the layer or maybe another approach? I've first came across this one Gradient Background, which seems not to work for me. I'm pretty sure I'm missing a step or over thinking it, appreciate the help in advance