如何检测是否支持UIMotionEffect?

时间:2015-04-28 11:12:07

标签: ios7 ios8 iphone-4

有没有办法检测我的应用运行的设备是否支持UIMotionEffect

1 个答案:

答案 0 :(得分:1)

你可以这样测试:

if ([UIMotionEffect class]) {
    // do stuff with UIMotionEffect
} else {
    // UIMotionEffect does not exists
}

在iOS< 4.2这样做:

Class theClass = NSClassFromString(@"UIMotionEffect");
if (theClass) {
    // do stuff with UIMotionEffect
} else {
    // UIMotionEffect does not exists
}