Ios DidSelectRowatineXpath仅在长按嵌入容器视图中的表视图时调用
我在containerView中有一个Ios DidSelectRowatineXpath仅在长按嵌入容器视图中的表视图时调用,ios,objective-c,uitableview,uicontainerview,Ios,Objective C,Uitableview,Uicontainerview,我在containerView中有一个UItableViewController,当我触摸其中一个单元格时,它不会调用didSelectRowAtIndexPath。但是,如果我长按,通常会调用此方法 我使用了情节提要,我的委托和数据源是我的tableViewController 以下是我的tableViewController代码: #pragma mark - Table view data source - (NSInteger)numberOfSectionsInTableView:(
UItableViewController
,当我触摸其中一个单元格时,它不会调用didSelectRowAtIndexPath
。但是,如果我长按,通常会调用此方法
我使用了情节提要
,我的委托
和数据源
是我的tableViewController
以下是我的tableViewController代码:
#pragma mark - Table view data source
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
return nuberOfSections;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return nuberOfSections;
}
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
return heightForHeader;
}
- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section {
return 0.01f;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
MWSideMenuTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"menuCell"];
// cell settups
return cell;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
[tableView deselectRowAtIndexPath:indexPath animated:YES];
// Some action done
}
可能有三个原因
同样的问题也发生在我身上,因为我在上面添加了轻拍手势识别器` 如果您使用了任何手势,请尝试将其删除
`并检查是否是它导致了问题。您是否在任何视图中使用了任何手势识别器?您确定您没有意外地实现
didSelect…
,而不是didSelect…
?我遇到了相同的问题,你们对此有什么结论吗?我刚刚遇到这个问题,发现我在容器视图控制器上设置了一个点击手势识别器来关闭键盘。检查您是否有相同的问题。