Blurring effect disappeared on iOS 7.1

送分小仙女□ 提交于 2019-12-03 09:48:10

问题


For some reason the blur effect is gone from my app on iOS 7.1. I'm running the same code on a device with iOS 7.0.x and on another with 7.1. Here's what I see:

iOS 7.0.x

iOS 7.1

What can be the issue and how to fix this? (obviously I want to keep the blur effect :))

UPDATE:

This is the color I set:

    [UIColor colorWithRed:255.0f/255.0f
                       green:201.0f/255.0f
                        blue:0.0f/255.0f
                       alpha:1.0];

and I set it from the barTintColor property


回答1:


Probably the second screenshot is taken from an iPhone 4 ? On the iPhone 4 and iPad 2 blur effect is replaced with a simply sample color with transparency.




回答2:


By the way, it's worth noting that the image that you describe as having no blurring/translucency actually does. If you take that snapshot and pump up the contrast, you can see that there actually is something going on in the background. Here is your original "no blurring/translucency image", which I bumped up contrast in Photoshop:

It's barely visible to the naked eye unless you manipulate the image, but the blurring/translucency is actually there.




回答3:


Settings > General > Increase Contrast > Reduce Transparency is probably enabled on the 7.1 device.




回答4:


At a glance

It seems the navigation bar simply doesn't have anymore blur effet since iOS7.1. At least I ran many tests, by doing new app sample, it doesn't have anymore.

Workaround (work on iOS 7.1)

Here a sample using FXBlurView

It's not marvelous but it works fine and it's customizable. My example is certainly not the best.

Previous solution proposed (doesn't work on iOS7.1)

Here is my solution to find back a similar effect. It is ok for release it doesn't use private API. But it can have issue with next update of iOS since it rely on inside structure of UINavigationBar.

Simply do that in your viewDidLoad or where ever you want since it works :

// First we make the background's navigation bar totally translucent
self.navigationController.navigationBar.barTintColor = [UIColor clearColor];
[self.navigationController.navigationBar setBackgroundImage:[UIImage imageWithColor:[UIColor clearColor]] forBarPosition:UIBarPositionAny barMetrics:UIBarMetricsDefault];

// Then we create UIToolBar, which are still using blur effect
UIToolbar *tab = [[UIToolbar alloc] initWithFrame:CGRectMake(0, 0, 320, 64)];
// We add it the barTintColor we want, works the same as since iOS 7.0.3, don't forget alpha value
tab.barTintColor = [UIColor colorWithRed:0 green:1 blue:0 alpha:0.2];

// And finally we add it to the background view of UINavigationBar... but it can change with future release of iOS. Be aware !
[[self.navigationController.navigationBar.subviews firstObject] addSubview:tab];

I also advice you to use AutoLayout to constraint the UIToolBar to be always the size of it's parent, for rotations etc... I didn't do it to let the code short and simple.

Hope it helps you guys !



来源:https://stackoverflow.com/questions/22689089/blurring-effect-disappeared-on-ios-7-1

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!