你的意思是两个view,通过点击手势进行判断,如果是这样,设置tag来区分<pre t="code" l="java"> view1.tag = 1
<br>
<br> UITapGestureRecognizer *tapGestureRecognizer1 = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapped:)]
<br>
<br> [view1 addGestureRecognizer:tapGestureRecognizer]
<br>
<br>
<br>
<br> view2.tag = 2
<br>
<br> UITapGestureRecognizer *tapGestureRecognizer2 = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapped:)]
<br>
<br> [view2 addGestureRecognizer:tapGestureRecognizer2]
<br>
<br>
<br>
<br>- (void)tapped:(UITapGestureRecognizer *)gesture
<br>
<br>{
<br>
<br> UIView *targetview = gesture.view
<br>
<br> if(targetview.tag == 1) {
<br>
<br>
<br>
<br> }
<br>
<br>}
如若满意,请点击右侧【答案】,如若还有问题,请点击【追问】
希望我的回答对您有所帮助,!
~ O(∩_∩)O~
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)