检测设备是否正确显示UIVisualEffectView? [英] Detect if device properly displays UIVisualEffectView?

查看:114
本文介绍了检测设备是否正确显示UIVisualEffectView?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

My app utilizes UIVisualEffectView to blur the background just like Control Center. But I discovered the iPad 2 (and Retina iPad) which can run iOS 8 isn't powerful enough to display that effect so it reverts to a gray color. I would like to be able to detect if the device the app is running on is powerful enough to display the blur effect, and if not I won't apply it, instead I'll change the background color to something that looks much better than that gray color. But I don't want to just check if the device is an iPad 2 or iPad 3rd gen (does it affect 4th as well?). Is there a better way to detect if the UIBlurEffect will appear as expected?

推荐答案

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

Check this WWDC session: http://asciiwwdc.com/2014/sessions/419


所以,重申我们不会模糊的设备以及我们只在iPad 2和iPad第3代上进行着色,我们只需应用我们跳过模糊步骤。

So, and to reiterate on what devices we don't blur and that we only do the tinting on the iPad 2 and iPad 3rd generation, we just apply the tint and we skip the blur steps.

[...]

在iPad上第4代,iPad Air ,iPad Mini,带视网膜显示器的iPad Mini,iPhone和iPod touch我们同时进行模糊和着色。

On iPad 4th generation, iPad Air, iPad Mini, iPad Mini with retina display, iPhones and the iPod touch we do both the blur and the tinting.

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

I guess you have to resort to checking for the machine name:

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

struct utsname systemInfo;
uname(&systemInfo);

NSString *deviceName = [NSString stringWithCString:systemInfo.machine encoding:NSUTF8StringEncoding];
...

这篇关于检测设备是否正确显示UIVisualEffectView?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆