【问题标题】:Custom cell in UITableView (iOS 9)UITableView (iOS 9) 中的自定义单元格
【发布时间】:2023-12-19 15:38:02
【问题描述】:

我有一个包含 uibutton 的自定义单元格的简单表格视图。更新到 iOS 9 GM 或 9.1 Beta 1(没关系)后,单元格上的按钮停止响应触摸。我还在单元类中创建了 IBAction 方法,它也根本不起作用

cell.username.setAttributedTitle(attrNameString, forState: .Normal)
cell.username.tag = notify.likeObject.likedUserId.integerValue
cell.username.addTarget(self, action: "showProfile:", forControlEvents: .TouchUpInside)

【问题讨论】:

  • 编辑您的问题的标题。当前标题应该在标签中。

标签: ios swift uitableview swift2 ios9


【解决方案1】:

好的,我找到了解决办法。我从 XIB 创建单元格时的问题。所以我在单元格中添加了self.contentView.userInteractionEnabled = false,它解决了这个问题

【讨论】: