作者热门文章
- android - RelativeLayout 背景可绘制重叠内容
- android - 如何链接 cpufeatures lib 以获取 native android 库?
- java - OnItemClickListener 不起作用,但 OnLongItemClickListener 在自定义 ListView 中起作用
- java - Android 文件转字符串
我最近开始使用 sprite-kit
。我知道 touchesBegan
只需轻按一下即可,但我可以使用什么来识别按住的触摸吗?
最佳答案
如果你想实现像射击这样的东西,那么你需要在touchesBegan
方法中开始射击,在touchesEnded
方法中停止射击:
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
[self startShooting];
}
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {
[self stopShooting];
}
对于其他目的,您可以添加 UILongPressGestureRecognizer
到 SKScene
关于ios - 如何为 sprite kit 实现触摸和按住?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21717574/
我是一名优秀的程序员,十分优秀!