甜橘子,专注成都网站制作网站设计与营销型网站建设与优化
QQ :
532337155
电话:
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://chengdu.cdxwcx.cn/article/jsdjjo.html
其他资讯
怎么在微信小程序中实现文章详情页面
虚拟主机网站连接不稳定如何解决
MySQL中如何使用索引
html5中如何使用设置或返回音频/视频是否默认静音的属性defaultMuted
java常见的微服务框架有哪些
QQ咨询
在线咨询
官方微信
联系电话
座机
028-86922220
手机
13518219792
返回顶部