Share on Google+Share on Google+

Gradient Background iPhone

Advertisement
In this tutorial, we are going to show you how to change UINavigationBar Color in Gradient. This example is similar to our previous one, only difference is that this time we are passing four arguments to the tintColor in different range.

Gradient Background iPhone

In this tutorial, we are going to show you how to change UINavigationBar Color in Gradient. This example is similar to our previous one, only difference is that this time we are passing four arguments to the tintColor in different range. That will actually give it a gradient look.

Change Color of the UINavigation Bar

UINavigationBar - Gradient Color

self.navigationController.navigationBar.tintColor = [UIColor colorWithRed:.6 green:.4 blue:.7 alpha:2];

UINavigationBar - Single Color
[self.navigationController.navigationBar setTintColor:[UIColor blackColor]];

Create a Navigation based application and add the given code in the viewController.m (implementation) file.

- (void)viewWillAppear:(BOOL)animated {

[super viewWillAppear:animated];
self.navigationController.navigationBar.tintColor = [UIColor colorWithRed:.6 green:.4 blue:.7 alpha:2];
}

Build your application and it must look like given image...

Download Code

Advertisements

Advertisement

Posted on: April 21, 2010 If you enjoyed this post then why not add us on Google+? Add us to your Circles

Share this Tutorial Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.