【发布时间】:2014-06-15 17:40:55
【问题描述】:
我在 containerView 中有一个 UItableViewController,当我触摸其中一个单元格时,它不会调用 didSelectRowAtIndexPath。但是,如果我长按,这个方法是正常调用的。
我用过storyboard,我的delegate 和datasource 是我的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
}
【问题讨论】:
-
您是否在任何视图中使用任何手势识别器?
-
你确定你没有实现
didDESelect...而不是didSelect...? -
我遇到了同样的问题,你对此有什么结论吗?
-
我刚刚遇到了这个问题,发现我在容器视图控制器上设置了一个点击手势识别器来关闭键盘。检查你是否有同样的问题。
标签: ios objective-c uitableview uicontainerview