uitableviewcell 中subview的UIGestureRecognizer
来源:互联网 发布:破解公司网络限制软件 编辑:程序博客网 时间:2024/04/19 22:01
当某一个view,比如UIImageView为Cell的subview时,为其添加gesture时,会被cell的contentview接收到,从而无法响应该手势。
这时,可以通过将手势添加到self.table中,再判断touch的坐标是否落在UIImageView中来确定是否执行tap的操作
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(magnifyImage)]; tap.delegate = self; self.tableView.userInteractionEnabled = YES; [self.tableView addGestureRecognizer:tap];
#pragma mark - UIGestureRecognizerDelegate- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch{ // 输出点击的view的类名 NSLog(@"%@", NSStringFromClass([touch.view class])); //获得当前手势点击在cell中的坐标 CGPoint p = [touch locationInView:touch.view]; //看看手势点的坐标是不是在avatarImageView中 if (CGRectContainsPoint(self.avatarImageView.frame, p)) { return YES; } return NO;}
0 0
- uitableviewcell 中subview的UIGestureRecognizer
- 如何释放含有NSTimer的UITableViewCell(SubView)
- UIGestureRecognizer覆盖UITableViewCell点击事件的解决办法
- UI: UIGestureRecognizer IOS中手势的用法
- 一些 UIView 中管理 Subview 常用的方法
- 一些 UIView 中管理 Subview 常用的方法
- 一些 UIView 中管理 Subview 常用的方法
- 一些 UIView 中管理 Subview 常用的方法
- 一些 UIView 中管理 Subview 常用的方法
- 一些UIView中管理Subview常用的方法
- 一些 UIView 中管理 Subview 常用的方法
- subview的管理
- UITableViewCell中KVO的使用
- IOS 中使用的手势 ,用到的类UIGestureRecognizer
- 打印subview的层次结构
- UIGestureRecognizer 的共存
- UIGestureRecognizer 的共存
- iOS UIGestureRecognizer的使用
- 收集的感觉不错的学习网站(持续更新中)
- NYOJ-46 最少乘法次数
- ubuntu下安装Apache+PHP+Mysql
- 黑马程序员----------java基础知识
- PHP下添加pdo_pgsql扩展
- uitableviewcell 中subview的UIGestureRecognizer
- Linux 安装 flash插件
- 关于iOS的error: linker command failed with exit code 1 (use -v to see invocation)错误
- ZOJ 3829 模拟贪心
- poj1125 floyd
- poj1004
- PowerDesigner 概念数据模型(CDM) 说明
- 题解053-434(V13.02版本,711题)
- Hadoop2.4.1 + ZK + HBase 环境搭建