Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/27.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios DidSelectRowatineXpath仅在长按嵌入容器视图中的表视图时调用_Ios_Objective C_Uitableview_Uicontainerview - Fatal编程技术网

Ios DidSelectRowatineXpath仅在长按嵌入容器视图中的表视图时调用

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:(

我在containerView中有一个
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
}

可能有三个原因

  • 未设置委托
  • 可能是DidSelectRowatineXpath中的输入错误
  • 手势识别器可用于容器VC或包含VC的容器中

  • 同样的问题也发生在我身上,因为我在上面添加了轻拍手势识别器`

    如果您使用了任何手势,请尝试将其删除


    `并检查是否是它导致了问题。

    您是否在任何视图中使用了任何手势识别器?您确定您没有意外地实现
    didSelect…
    ,而不是
    didSelect…
    ?我遇到了相同的问题,你们对此有什么结论吗?我刚刚遇到这个问题,发现我在容器视图控制器上设置了一个点击手势识别器来关闭键盘。检查您是否有相同的问题。