看板 MacDev 關於我們 聯絡資訊
大家好 目前碰到的問題是 我在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
stweber2001: 你的底層view(如self.view等等)上是否有其他手勢? 03/08 15:59
chengpocheng: 我剛檢查過確定沒有加上任何手勢 03/08 16:34
chengpocheng: 而且又發現Swipe手勢可以馬上觸發 好奇怪 03/08 16:35
kokuyoku: UITableViewCell的subview清空也是一樣嗎? 03/09 10:48