Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UIVisualEffectView renders differently on different devices

Tags:

ios

swift

ios8

In my ViewController.swift:

var img = UIImageView(image: UIImage(named: "puddles"))

img.frame = view.bounds;
view.addSubview(img);


var effect = UIBlurEffect(style: UIBlurEffectStyle.Light)
var effectView = UIVisualEffectView(effect: effect)
effectView.frame = CGRectMake(0, 0, 500, 500)
view.addSubview(effectView)

The image as rendered using the code above in the iPad Air, iPhone 5, or iPhone 5S simulators:

woof, doesn't that look so good

The image as rendered using the code above in the iPhone 4S, iPad 2, or iPad Retina simulators:

I can't see my doge!

Note: Both images above were taken from the simulator, but this can be reproduced on actual devices running iOS 8 Beta 1 as well.

Obviously, I would like to achieve the first effect on all devices. How can I achieve the same first effect on all devices?

like image 989
Andrew Avatar asked Jun 09 '14 21:06

Andrew


2 Answers

UIVisualEffectView in iOS 8 does pretty much the same thing as the (formerly private API) translucency and vibrancy effects seen in iOS 7. Like the iOS 7 effects, they fall back to graphically simpler implementations on hardware that can't render such complex graphics effects in realtime.

like image 52
rickster Avatar answered Oct 30 '22 09:10

rickster


We hit this issue recently when our Visual Effect View was an ugly grey color on one of our developer's machines.

UIVisualEffect *blurEffect = [UIBlurEffect effectWithStyle:UIBlurEffectStyleLight];
UIVisualEffectView *visualEffectView = [[UIVisualEffectView alloc] initWithEffect:blurEffect];

It turns out that they had enabled Low Quality Graphics Override on their iOS Simulator. Turning this option back to Device Default fixes the issue and displays a nice translucent view.

iOS Simulator > Menu Bar > Debug > Graphics Quality Override > Device Default

Low quality graphics override option in iOS Simulator

like image 29
pkamb Avatar answered Oct 30 '22 07:10

pkamb