Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
タッチ時間を計算したり、長いタッチや小さなドラッグを使用していないことを検出したりするネイティブの cocos2d メソッドはありますUILongPressGestureRecognizerか?
UILongPressGestureRecognizer
ccTouchBeganイベントとccTouchEndedイベントの間の時間を登録する必要があります。
UITouchオブジェクトには次のプロパティがあります。
@property(nonatomic, readonly) NSTimeInterval timestamp;
したがって、ccTouchBeganイベントを取得したときに、最初の時間間隔の値をいくつかのivarに格納し、ccTouchEndedで取得した時間との差をとるだけです。