13

我的应用程序UIVisualEffectView像控制中心一样使用模糊背景。但我发现可以运行 iOS 8 的 iPad 2(和 Retina iPad)功能不够强大,无法显示这种效果,所以它会恢复为灰色。我希望能够检测运行应用程序的设备是否足够强大以显示模糊效果,如果不是,我不会应用它,而是将背景颜色更改为看起来比那灰色。但我不想只检查设备是 iPad 2 还是 iPad 3rd gen(它也会影响 4th 吗?)。有没有更好的方法来检测是否UIBlurEffect会按预期出现?

4

2 回答 2

9

检查此 WWDC 会话:http ://asciiwwdc.com/2014/sessions/419

所以,重申一下我们不会模糊哪些设备,并且我们只在 iPad 2 和 iPad 3 代上进行着色,我们只应用着色并跳过模糊步骤。

[...]

在第四代 iPad、iPad Air、iPad Mini、配备 Retina 显示屏的 iPad Mini、iPhone 和 iPod touch 上,我们同时进行模糊和着色。

我想你必须求助于检查机器名称:

#import <sys/utsname.h>
...

struct utsname systemInfo;
uname(&systemInfo);

NSString *deviceName = [NSString stringWithCString:systemInfo.machine encoding:NSUTF8StringEncoding];
...
于 2014-11-16T08:19:13.660 回答
2

Apple 在内部使用[UIDevice _graphicsQuality]此类检查。在下面的帖子中,我提出了一种仅使用公共 API 的方法:https ://stackoverflow.com/a/27879304/1914276

于 2015-01-10T17:59:13.837 回答