tableViewcell上进行手势的添加
来源:互联网 发布:蜘蛛池外推软件 编辑:程序博客网 时间:2024/05/16 15:16
未进行操作时是这样的:
轻扫或者点击之后为这样的:
self.isLeft = NO;//默认为左边按钮是不出现的状态//编辑按钮self.editButton = [[UIButton alloc] initWithFrame:CGRectMake(BOUNDS.size.width-46, 0, 46, 43)]; [_editButton setImage:[UIImage imageNamed:@""] forState:UIControlStateNormal]; [_editButton addTarget:self action:@selector(editAction:) forControlEvents:UIControlEventTouchUpInside]; [self.contentView addSubview:_editButton];
//删除按钮 self.deleteBtn = [[UIButton alloc] initWithFrame:CGRectMake(_editButton.frame.origin.x, 47, _editButton.frame.size.width, _editButton.frame.size.height)]; [_deleteBtn setImage:[UIImage imageNamed:@""] forState:UIControlStateNormal]; [_deleteBtn addTarget:self action:@selector(deleteAction:) forControlEvents:UIControlEventTouchUpInside]; [self.contentView addSubview:_deleteBtn];
//向左轻扫 UISwipeGestureRecognizer *leftRecognizer = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(leftRecognizerThisCell:)]; leftRecognizer.direction = UISwipeGestureRecognizerDirectionLeft; [self.subView addGestureRecognizer:leftRecognizer]; //向右轻扫 UISwipeGestureRecognizer *rightRecognizer = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(rightRecognizerThisCell:)]; rightRecognizer.direction = UISwipeGestureRecognizerDirectionRight; [self.subView addGestureRecognizer:rightRecognizer]; //点击 UITapGestureRecognizer *pan = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(panRecognizerThisCell:)]; [self.subView addGestureRecognizer:pan];
//手势的触发//向左轻扫时手势添加的这个view左移动- (void)leftRecognizerThisCell:(UIGestureRecognizer *)gesture{ UIView *view = gesture.view; [UIView animateWithDuration:0.2 animations:^{ view.frame = CGRectMake(-46, _subView.frame.origin.y, _subView.frame.size.width, _subView.frame.size.height); _isLeft = YES; }];}//向右轻扫时手势添加的这个view右移动- (void)rightRecognizerThisCell:(UIGestureRecognizer *)gesture{ UIView *view = gesture.view; if (_isLeft) { [UIView animateWithDuration:0.2 animations:^{ view.frame = CGRectMake(0, 0, _subView.frame.size.width, _subView.frame.size.height); _isLeft = NO; }]; }}//点击时,先判断此时的状态- (void)panRecognizerThisCell:(UIPanGestureRecognizer *)gesture{ if (_isLeft) { [self rightRecognizerThisCell:gesture]; } else { [self leftRecognizerThisCell:gesture]; }}
0 0
- tableViewcell上进行手势的添加
- iOS tableViewCell 的移动操作 (添加长按手势)
- tableviewcell 上添加的button的响应方法
- iOS开发,TableViewCell上添加Xib创建的View会出现页面混乱
- 在webView上添加手势
- 在按钮上添加长按手势的一些问题
- 同一个view上添加两个相同的手势
- 关于在UITableView上添加PanGesture手势的方法
- TableViewCell 里面嵌的TableViewCell 如何点击里面的TableViewCell进行页面跳转?
- iOS 手势 点击tableViewCell 传不同的值
- Cell上的subView添加手势 与 cell点击手势冲突
- 如何给scrollview上添加的子控件UIView上添加手势
- xib方式 在tableviewcell上添加button (代理方式)
- tableViewCell上动态的进度条问题
- iOS端如何解决自定义滑动退出手势与TableViewCell删除手势之间的冲突问题
- 添加手势 向右滑的手势
- ios的手势的添加
- 关于对一堆图片进行添加手势显示大图仔细观看的处理
- RestAPI工具Chrome插件Postman的安装方法和安装包下载问题
- Android Studio debug使用release的签名
- openssh FAQ
- Objective-C categories in static library链接库真实链接的大小
- VS2005下使用VC,部分断点无效,显示『当前不会命中断点。还没有为该文档加载任何符号』。
- tableViewcell上进行手势的添加
- 初次使用Qt Creater网络编程,出现error: undefined reference to `_imp__WSAStartup@8'
- 【MySQL】【leetcode】 Delete Duplicate Emails解题报告
- Android之调用微信登陆、分享、支付
- Eclipse中hadoop2.7.1的插件下载及安装步骤
- DWZ文件上传,time转化
- spark mllib 中的tf-idf算法计算文档相似度
- 取得硬盘剩余空间的Java代码
- mysql 和oracle的函数比较