【问题标题】:iOS - UITableView Cell not touchableiOS - UITableView Cell 不可触摸
【发布时间】:2013-08-08 15:42:40
【问题描述】:

快速提问,我正在 UIView 中创建一个自定义弹出窗口,其中 UIImageView 作为背景,UITableView 覆盖在顶部。它有三个单元格,但由于某种原因,底部的两个单元格是可点击的,而顶部的则不是。当我 NSLog 触摸时,这就是我得到的:

touching <UIView: 0xa3d0200; frame = (0 0; 320 460); autoresize = W+H; tag = 333; layer = <CALayer: 0xa3d0260>>

它说它触动了 self.view。有什么想法吗?

【问题讨论】:

  • 你的细胞是什么样的?它们是静态原型还是动态原型?
  • 动态原型。每个单元格本质上都有 1 个标签。
  • 好的,好的。您可以在创建它们的位置发布代码(即numberOfRowsInSection、cellForRowAtIndexPath 方法吗?)
  • 可能是表视图的顶部超出了其父视图的范围。将其父视图的 clipsToBounds 设置为 YES,并查看表格的一部分是否消失。
  • - (UITableViewCell *) tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *cellIdentifier = @"OptionsCell"; OptionsCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier]; if (cell == nil) { NSArray *nib = [[NSBundle mainBundle] loadNibNamed:@"OptionsCell" owner:self options:NULL];单元格 = (OptionsCell *)[nib objectAtIndex:0]; } cell.cellTitle.text = [self.optionsData objectAtIndex:[indexPath row]];返回单元格; }

标签: ios uitableview


【解决方案1】:

我想通了,我只需将超级视图放大一点,一切都按预期工作。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-09-12
    • 1970-01-01
    • 2011-11-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多