我有一个视图,在那个视图上我添加了一个UITapGesture
. 现在,当我在视图中放置一个按钮并单击该按钮时,它不会调用按钮操作。
这是我的代码:
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");
}