bha*_*vik 2 iphone xcode objective-c ios 3dtouch
我有我的 ios 应用程序,我想检查 3D touch 的可用方式(iPhone 6s 或 iPhone6s plus)?
那么我该如何检查呢?
小智 5
你应该试试这个。
//check if the device supports 3DTouch
if(self.traitCollection.forceTouchCapability == UIForceTouchCapabilityAvailable){
[self registerForPreviewingWithDelegate:self sourceView:self.view];
}else{
[[[UIAlertView alloc] initWithTitle:@"Error" message:@"3DTouch not available" delegate:nil cancelButtonTitle:@"Ok" otherButtonTitles:nil] show];
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1321 次 |
| 最近记录: |