需求要做一个这样的下拉弹窗 点击弹窗选中Cell 点击其他区域弹窗消失
111.png贴代码
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(onTapDissMissSelf)];
self.userInteractionEnabled = YES;
tap.delegate = self;
[self addGestureRecognizer:tap];
解决冲突代码 这个是UIGestureRecognizerDelegate 代理方法
-(BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch
{
if ([NSStringFromClass([touch.view class]) isEqualToString:@"UITableViewCellContentView"]) {//如果当前是tableView
//做自己想做的事
return NO;
}
return YES;
}
网友评论