我一直在建立一个SpriteKit游戏.它是一款纸牌游戏,允许双击卡精灵以获得特定行为.现在我们在iOS 9中,双击在iPhone 6s上根本不起作用.适用于iOS8,所有设备.
在我的SKScene中,我使用touchesBegan方法来检测水龙头:
-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
UITouch *touch = [touches anyObject];
CGPoint touchLocation = [touch locationInNode:self];
if(touch.tapCount==2) {
NSLog(@"double-tap, but not for iPhone 6s");
}
}
对于SpriteKit游戏,现在需要实现iOS9或者6s(3d touch?)的新功能吗?
我想指出,这在iPhone 6s模拟器中工作正常,但它不在实际设备上.
此外,touch.tapCount将报告3,4,5,6,7等点击,但完全跳过第二次点击.
最佳答案 根据
https://developer.apple.com/library/prerelease/ios/releasenotes/General/RN-iOSSDK-9.1/
UIKit
Note
On 3D Touch capable devices, touch pressure changes cause
touchesMoved:withEvent: to be called for all apps running on iOS 9.0.
When running iOS 9.1, the method is called only for apps
linked with the iOS 9.0 (or later) SDK.
Apps should be prepared to receive touch move events
with no change in the x/y coordinates.
所以如果这个问题可以由touchMoved引起.