【发布时间】:2015-11-10 14:02:13
【问题描述】:
我正在使用 Parse.com 构建我的应用程序。
我将PFQueryTableViewController 初始化为我的子类。
我无法点击 indexPath.row 以使单元格指向另一个 viewController 并传递数据。
override func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
print("tapped")
//Nothing prints. The simulator cell doesn't even change color as it normally does...
}
在没有 Parse 的普通项目中,我点击它,它会将我引导到我希望它引导的位置。我不明白为什么这在这里不起作用。
我参考了几个链接,比如:
- https://www.parse.com/questions/pfquerytableview-didselect-row-open-pbobject-in-uiwebview(过时且客观-c)
- https://www.parse.com/questions/using-pfquerytableviewcontroller-in-detail-view(没用)
- didSelectRowAtIndexPath method at PFQueryTableViewController(也没有用)
没有任何帮助。
我还尝试在自定义单元格的视图上使用 UIGestureecognizer。这也无济于事......
这是属性检查器:
http://postimg.org/image/3omx3serh/
我已选择和取消选择相关部分。没有任何效果。
编辑:我也在使用初始化器:
override init(style: UITableViewStyle, className: String!)
{
super.init(style: style, className: className)
self.pullToRefreshEnabled = true
self.paginationEnabled = false
self.objectsPerPage = 25
self.parseClassName = className
self.tableView.rowHeight = 120
self.tableView.allowsSelection = false
}
required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
知道为什么我不能点击单元格吗?关于如何点击单元格的任何想法?
【问题讨论】:
-
您是否有一个 uibutton 或其他可以接收点击而不传递到您的单元格的东西?
-
应该是单元格本身。 didSelectRowAtIndexPath 应该触发到另一个 viewController 的 segue。甚至被认为存在一个细胞。 cellForRowAtIndexPath 有效,它在 UI 上打印不同的标签和按钮。但我希望细胞本身能够捕捉到触摸。
标签: swift parse-platform swift2 didselectrowatindexpath parseui