ios - 如何为 sprite kit 实现触摸和按住?

标签 ios iphone ipad sprite-kit

我最近开始使用 sprite-kit。我知道 touchesBegan 只需轻按一下即可,但我可以使用什么来识别按住的触摸吗?

最佳答案

如果你想实现像射击这样的东西,那么你需要在touchesBegan方法中开始射击,在touchesEnded方法中停止射击:

- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
    [self startShooting];
}

- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {
    [self stopShooting];
}

对于其他目的,您可以添加 UILongPressGestureRecognizerSKScene

关于ios - 如何为 sprite kit 实现触摸和按住?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21717574/

相关文章:

c# - AES - c# 加密和 objective-c 解密不起作用

ios - 无法在此文件中预览 - [应用程序名称].app 可能在 Xcode 11 Beta 5 上崩溃

ios - 如何快速添加 subview Controller ?

flash - 如何在 iOs 的 Flash 应用程序中播放视频 (iPhone Packager)

iphone - iOS电话簿中的自定义UITextField

javascript - 在 Safari 中使用 PHP 清除 Cookie 的行为很奇怪

ios - iOS 和 Objective C 中的循环过渡( mask )

objective-c - SLComposeViewController 完成处理程序

iphone - 如何检查为什么 viewWillDisappear : is called

iphone/ipad 标准 twitter oauth 模块?