快上网专注成都网站设计 成都网站制作 成都网站建设
成都网站建设公司服务热线:028-86922220
网站建设
移动开发
小程序开发
运维推广
网站推广
网站推广
运维外包
运维外包
网站报价
经典案例
网站知识
关于我们
网站建设知识
十年网站开发经验 + 多家企业客户 + 靠谱的建站团队
量身定制 + 运营维护+专业推广+无忧售后,网站问题一站解决
uitableviewcell的长按事件
UILongPressGestureRecognizer *lpgr = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(handleLongPress:)];
lpgr.minimumPressDuration = 1.0;
//seconds 设置响应时间
lpgr.
delegate
= self;
[mTableView addGestureRecognizer:lpgr];
//启用长按事件
[lpgr release];
-(
void
)handleLongPress:(UILongPressGestureRecognizer *)gestureRecognizer
//长按响应函数
{
CGPoint p = [gestureRecognizer locationInView:mTableView ];
//if(gestureRecognizer.state == UIGestureRecognizerStateBegan)
//{
//NSLog(@"UIGestureRecognizerStateBegan");
//}
//else if(gestureRecognizer.state == UIGestureRecognizerStateEnded)
//{
//NSLog(@"UIGestureRecognizerStateEnded");
//}
//else if(gestureRecognizer.state == UIGestureRecognizerStateChanged)
//{
//NSLog(@"UIGestureRecognizerStateChanged");
//}
//else if(gestureRecognizer.state == UIGestureRecognizerStateCancelled)
//{
//NSLog(@"UIGestureRecognizerStateCancelled");
//}
//else if(gestureRecognizer.state ==UIGestureRecognizerStateFailed )
//{
//NSLog(@"UIGestureRecognizerStateFailed");
//}
NSIndexPath *indexPath = [mTableview indexPathForRowAtPoint:p];
//获取响应的长按的indexpath
if
(indexPath == nil)
NSLog(
@"long press on table view but not on a row"
);
else
NSLog(
@"long press on table view at row %d"
, indexPath.row);
}
网页题目:uitableviewcell的长按事件
文章分享:
http://6mz.cn/article/jsdjjo.html
其他资讯
SAPBD87如何将IDoc状态修改为68-创新互联
Java实现编译与运行示例-创新互联
PHP中的日期函数如何使用-创新互联
Python爬虫开发的3大难题,别上了贼船才发现,水有多深-创新互联
Centos7.x配置PostgreSQL自启动-创新互联