0

UIWindowの上にUIimageviewを使用しています。そのImageviewのタッチイベントを処理したいのですが、できません。

UIviewでUIimageViewを使用する場合、touchBegan、touchEndedを使用できますが、UIViewではなくUIWindowにある場合の処理​​方法。

ありがとう..

4

2 に答える 2

2

タップを処理するだけの場合は、設定する必要があります。

imageView.userInteractionEnabled = YES;

デフォルトでは、UIImageView のuserInteractionEnabledプロパティNOに設定されています。それにタップジェスチャレコグナイザを追加できます

UITapGestureRecognizer *tgr = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(anyMethod)];
[imageView addGestureRecognizer:tgr];
[tgr release];

画像を移動したい場合は、UIPanGestureRecognizerを使用できます。

于 2011-07-09T04:38:37.487 に答える
0
- (void)sendEvent:(UIEvent *)event

try this function

于 2011-07-09T04:47:02.280 に答える