UISwipeGestureRecognizer *recognizer = [[UISwipeGestureRecognizer alloc] initWithTarget:self
action:@selector(handleSwipeLeft:)];
[recognizer setDirection:(UISwipeGestureRecognizerDirectionLeft)];
[self.tableView addGestureRecognizer:recognizer];
[recognizer release];
- (void)handleSwipeLeft:(UISwipeGestureRecognizer *)gestureRecognizer
{
//Get location of the swipe
CGPoint location = [gestureRecognizer locationInView:self.tableView];
//Get the corresponding index path within the table view
NSIndexPath *indexPath = [self.tableView indexPathForRowAtPoint:location];
//Check if index path is valid
if(indexPath)
{
//Get the cell out of the table view
UITableViewCell *cell = [self.tableView cellForRowAtIndexPath:indexPath];
//Update the cell or model
cell.accessoryType = UITableViewCellAccessoryCheckmark;
}
}
分享到:
相关推荐
在UITableView中给每个UITableViewCell添加一个长按手势,在长按手势触发时,不会触发tableview的didSelectRowAtIndexPath方法,这样就不知道长按的是哪个cell,有一种简单的方法可以获得cell所在的indexPath。
基于手势操作的UITableView,实现cell左右滑动,点击cell扩展等效果。划动列表cell的动作有挺不错的bounce(弹性)效果。 编译测试,适用环境:Xcode 4.5, iOS 5.0 以上。
swift现实UITableView的cell自定义以及删除与添加,添加表的刷新功能
仿照淘宝天猫中的秒杀倒计时设计
uiscrollview uitableview 上拉 下拉 刷新
UITableView、UITableView基本用法、UITableView详解,UITabelView常用方法
很久之前上传的版本,有bug。 今天把之前的代码稍微调整了一点。 自己测试过没什么问题了。
UITableView相关操作
当UITableView遇到多cell时,往往我们要建立多个cell,这是就会显得类多,臃肿。 demo采用了工厂模式,用父类cell指针指向子类cell,减少类臃肿,不好维护的效果
UITableView用来以表格的形式显示数据。关于UITableView,我们应该注意: ...(4)所有的UITableView实现时实际上只有一列,但是我们可以通过向UITableViewCell中添加子视图,使得它看起来有好几列。
UITableView Cache - UITableView 缓存
UITableView教材 IPHONE IPAD
HGPlaceholders 为任何UITableView添加占位符的漂亮库
IOS UITableView UIcollectionView 结合
UITableView 详细讲解
UITableView通过重用单元格来达到节省内存的目的:通过为每个单元格指定一个重用标识符 reuseIdentifier 即指定了单元格的种类 以及当单元格滚出屏幕时 允许恢复单元格以便重用 对于不同种类的单元格使用不同的ID ...
由于数据比较多,在每行中需要显示多列数据,所以继需要用到纵向滚动,又要用到横向滚动。所以我就向UIScrollView中添加UITableView,因为根视图控制器是UINavigationController
实现了IOS UITableView上拉刷新和下拉加载的功能,可以运用的实际项目中去
UITableView 缩进 附属视图 Cell Demo
iOS UITableView查询及索引UISEARCHBAR