ios - 前 5 个单元格后未调用 didSelectRowAtIndexPath

标签 ios uitableview didselectrowatindexpath

我的表格相对简单,与我以前做过的许多表格没有根本不同。然而 didSelectRowAtIndexPath 仅在表格的前 5 个单元格上被调用。之后,当我点击时,调试语句不会出现。我在这里研究了这个问题并排除了其他问题中提到的一些可能性: - 表格代表已正确设置。 - GestureRecognizer(我设置的)没有吞下压力机。 - willSelectRowAtIndexPath 未实现

下面是我的didSelectRowAtIndexPath。让我知道我还能提供什么来帮助解决这个问题。

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath 
{

    NSLog(@"didSelect");
    NSArray *visibleCells = [partOfSpeechTable visibleCells];
    UITableViewCell *cell = [visibleCells objectAtIndex:indexPath.row];

    NSNumber *checkedState = [checkedStates objectAtIndex:indexPath.row];
    if ([checkedState boolValue]) 
    {
        [cell setAccessoryType:UITableViewCellAccessoryNone];
        [checkedStates setObject:[NSNumber numberWithBool:NO] atIndexedSubscript:indexPath.row];
    }
    else 
    {
        [cell setAccessoryType:UITableViewCellAccessoryCheckmark];
        [checkedStates setObject:[NSNumber numberWithBool:YES] atIndexedSubscript:indexPath.row];
    }

    [[tableView cellForRowAtIndexPath:indexPath] setSelectionStyle:UITableViewCellSelectionStyleNone];
}

(我可以注释掉所有附件,这没什么区别)。

感谢您的帮助。

最佳答案

事实证明,包含 View 比表本身要短。表格完整显示,但包含 View 截断下方的部分未响应用户交互。解决方案是增加包含 View 的大小。

关于ios - 前 5 个单元格后未调用 didSelectRowAtIndexPath,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18081500/

相关文章:

ios - 需要知道用户何时在iOS中单击键盘上的“返回”

ios - 如何获取 iOS 用于显示 UITableView 标题标题的默认字体详细信息?

ios - TableView 中的 cellForRowAt 未更新

ios - 滑动时 TableView 单元格高度

swift - 如何防止 UIDatePicker 被多次初始化

ios - 测试飞行错误: User gets "Unable to Download Application" message when trying to download a beta test from TestFlight

ios - 模拟器的自定义 Expo 开发客户端

ios - 想要在 objective-c 中创建字节数组

ios - 使用 UITableView 和数组无限滚动

ios - DidSelectRowAtIndexPath 不响应搜索显示 Controller