Make UINavigationBar translucent

I am making with a slideshow in it. I want the navigation bar to look the same as in the photo app. How do I get this transparency?

I have tried:

- (void)drawRect:(CGRect)rect {
    [[UIColor clearColor] set];
    CGContextFillRect(UIGraphicsGetCurrentContext(), rect);

}   

UIImage *bg = [UIImage imageNamed:@"navbar.png"];
UIImageView *background = [[UIImageView alloc] initWithImage:bg];
background.frame = self.navigationController.toolbar.bounds;
background.autoresizingMask = UIViewAutoresizingFlexibleWidth;
BOOL isIOS5 = [[[UIDevice currentDevice] systemVersion] intValue] >= 5;
self.navigationController.toolbar.backgroundColor = [UIColor clearColor];
[self.navigationController.toolbar insertSubview:background atIndex: (isIOS5 ? 1 : 0)];

Answers


I believe you are looking for the translucent property of UINavigationBar. Try:

[[self.navigationController navigationBar] setTranslucent:YES];

Need Your Help

Java Inheritance - this keyword

java inheritance override this

I searched online for similar question, but could not find it. So, posting here.

SIP Makefile fail (gnuwin and mingw)

python-2.7 makefile mingw python-sip gnuwin32

I have downloaded the Sip module for python 2.7, created a makefile and tried the make command on the directory with the makefile, but I get this error:

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.