いくつかの UIImageViews を追加する必要があるアプリケーションに取り組んでいます。モーダル ビュー コントローラーには、さまざまなボタンが表示されます。モーダル ビュー コントローラーを閉じると、追加する UIImageView を決定するのに役立つボタンのタグが送信されます。
最初に UIImageView を追加すると、すべてのジェスチャが機能します。しかし、2 番目のものを追加すると、最初のものはタッチに対する反応を失います。
UIImageView (Body:UIImageView) を追加するコードは次のとおりです。
-(void) addBodyToStage:(int)index {
NSString * imageString = [NSString stringWithFormat:@"Body%i.png",index];
UIImage * image = [UIImage imageNamed:imageString];
Body * body = [[Body alloc] initWithImage:image];
//For Pan Gestures
[body setUserInteractionEnabled:YES];
[body addGestureRecognizer:panGesture];
[panGesture addTarget:body action:@selector(handlePan:)];
//For Pinch Gestures
[pinchGesture addTarget:body action:@selector(handlePinch:)];
[body addGestureRecognizer:pinchGesture];
//Adding to the view
[self.view addSubview:body];
}