简体   繁体   中英

In iOS 7, how do I have a nav bar with a dark background color, but have it transparent and blurred?

With my app and iOS 7, I want to have a green background for the navigation bar.

From what I see, I have two options: set the background color directly with a UIColor corresponding to green. This causes the green to be very washed out, but it does cause it to be transparent and blurred.

The other option I figured is to create a green background image that you manually set transparent yourself, then set this image as the nav's background image. This works 95%, but the background is not blurred. It does keep the right color and make it transparent however.

What is the correct way to do this? For instance, the new Facebook app for iOS 7 accomplishes this beautifully with their blue.

Is this the effect you're looking for?

在此处输入图片说明

I did this using the bar's tint color:

[[UINavigationBar appearance] setBarTintColor:[UIColor colorWithRed:0.0f green:0.4f blue:0.0f alpha:1.0f]];

Of course, you could also use a navigation bar instance directly instead of using the appearance proxy.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM