J'ai une vue, et sur cette vue j'ai ajouté un UITapGesture
. Maintenant, quand je mets un bouton dans la vue et clique sur le bouton, il n'appelle pas l'action du bouton.L'action UIButton n'est pas appelée lorsque UITapGesture dans la vue
Voici mon code:
ButtionView=[[UIView alloc]initWithFrame:CGRectMake(x, y, 84, 84)];
ButtionView.tag=i;
UIImageView *coverImageView = [[UIImageView alloc]
initWithFrame:CGRectMake(0,0,ButtionView.frame.size.width,84)];
coverImageView.tag = i;
UIButton *notesbutton=[UIButton buttonWithType:UIButtonTypeRoundedRect];
notesbutton.frame=CGRectMake(0, 0,20,20);
notesbutton.tag=i;
[notesbutton addTarget:self action:@selector(buttonClickedForNotes:)
forControlEvents:UIControlEventTouchUpInside];
[ButtionView addSubview:coverImageView];
[ButtionView addSubview:notesbutton];
[notesbutton bringSubviewToFront:ButtionView];
[self.scrollview addSubview:ButtionView];
[ButtionView addGestureRecognizer:oneFingerSingleTap];
-(IBAction)buttonClickedForNotes:(id) sender
{
NSLog(@"buttion action call");
}
Regardez cette question, il devrait vous être un problème http://stackoverflow.com/questions/4825199/gesture-recognizer-and-button-actions –