作者chengpocheng (阿璋仔)
看板MacDev
标题[问题] UITableView 点选必须长按才能呼叫问题
时间Sun Mar 8 15:51:26 2015
大家好
目前碰到的问题是
我在UITableView里用xib客制Cell
当去使用didSelectRowAtIndexPath时候
必须要长按才能触发这个event
就像是在cell上面加上了UILongPressGesture的感觉
但其它页面的UITableView却没有这个问题
写法完全一模一样
不知为何同样的写法会有不同的回应时间
上网google的结果
大多是说是加了其他手势的关系
但我并没有加任何手势event到里面
可否麻烦各位给我一点指点
附上片段程式码
- (void)viewDidLoad {
[super viewDidLoad];
[demoTableView registerNib:[UINib nibWithNibName:@"customTableViewCell" bundle:nil] forCellReuseIdentifier:@"Cell"];
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *cellIdentifier = @"Cell";
customTableViewCell *cell = (customTableViewCell *)[tableView dequeueReusableCellWithIdentifier:cellIdentifier];
if (!cell) {
cell = [[surveyTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIdentifier];
}
return cell;
}
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
NSLog(@"test");
}
--
※ 发信站: 批踢踢实业坊(ptt.cc), 来自: 218.161.94.83
※ 文章网址: https://webptt.com/cn.aspx?n=bbs/MacDev/M.1425801088.A.6AA.html
1F:→ stweber2001: 你的底层view(如self.view等等)上是否有其他手势? 03/08 15:59
2F:→ chengpocheng: 我刚检查过确定没有加上任何手势 03/08 16:34
3F:→ chengpocheng: 而且又发现Swipe手势可以马上触发 好奇怪 03/08 16:35
4F:→ kokuyoku: UITableViewCell的subview清空也是一样吗? 03/09 10:48