1

別のビューを呼び出すメソッドがあります。画像が一定時間継続した後、このメソッドを呼び出したいと思います。

UIButton = touchDown()、touchup()にあるこのタイプのメソッド。

画像ビューで継続的なタッチを見つけるためのタッチイベントの方法はありますか?

plsは私を助けます。

前もって感謝します

4

3 に答える 3

0

タッチをカウントしたい場合(ダブルタップのように連続)

- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {
UITouch *touch = [[event allTouches] anyObject];

int index =[touch view].tag;

if (touch.tapCount == number && index == imageTag) {

}

}

tapCountは、非常に短い時間間隔(ダブルタップ)での継続時間のタップ数になります。見たいタップのカウントの遅延が長い場合(たとえば、5回のシングルタップ)は使用できません。または、次のように、イメージビューのタッチを覚えておくことができます。

 - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event{
      UITouch *touch = [[event allTouches] anyObject];
      int index =[touch view].tag;

      if(index == imagetag){
         if([tempMutableArray count] < definiteTime){
            [tempMutableArray addObject:@"any"]
           }else{ 
            [tempMutablArray removeAllObjects]; 
            //you can call the method now
            }
      }
}
于 2012-07-06T07:45:08.207 に答える
0

このスレッドで私が書いた答えを見ることができるタップジェスチャを使用できます。これで、イベントを発生させるために必要なタップの数を設定できます。これがお役に立てば幸いです。

于 2012-07-06T07:48:51.797 に答える
0

これらのイベントを UIIMAGEVIEW に使用できます。

- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event 

- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event 
于 2012-07-06T07:37:24.097 に答える