[問題] UITableView 點選必須長按才能呼叫問題

看板MacDev作者 (阿璋仔)時間10年前 (2015/03/08 15:51), 編輯推噓0(004)
留言4則, 3人參與, 最新討論串1/1
大家好 目前碰到的問題是 我在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://www.ptt.cc/bbs/MacDev/M.1425801088.A.6AA.html

03/08 15:59, , 1F
你的底層view(如self.view等等)上是否有其他手勢?
03/08 15:59, 1F

03/08 16:34, , 2F
我剛檢查過確定沒有加上任何手勢
03/08 16:34, 2F

03/08 16:35, , 3F
而且又發現Swipe手勢可以馬上觸發 好奇怪
03/08 16:35, 3F

03/09 10:48, , 4F
UITableViewCell的subview清空也是一樣嗎?
03/09 10:48, 4F
文章代碼(AID): #1K-_-0Qg (MacDev)
文章代碼(AID): #1K-_-0Qg (MacDev)