iOS 9 Spritekit双击不适用于iPhone 6S

时间:2015-10-09 16:09:59

标签: ios objective-c sprite-kit ios9 iphone-6

我一直在构建一个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等点击,但完全跳过第二次点击。

2 个答案:

答案 0 :(得分:1)

好的,所以,双击是工作的,有点。在iPhone 6s上,虽然通过function find(lname){ return user.filter(function(item){ return item.lname === lname; })[0]; } 报告60 fps,但游戏运行非常缓慢。我刚刚发现,如果我慢慢点击,我可以让水龙头工作,就像在第一次和第二次点击之间等待一秒钟一样。

现在发现为什么这个游戏在这个设备上这么慢。它甚至不是iOS 9的问题,因为游戏在我的5s / iOS 9上运行得很好。

答案 1 :(得分:1)

根据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引起的。