我面临着一种奇怪的UITableView
行为,我不知道这是从何而来的。我正在构建一个非常简单的单视图IOS8 Swift应用程序,其中包含第一个带有UITableView
的ViewController
和一个自定义的图像单元格。当我点击一个手机时,它会被插入到我的SecondViewController
上。
我的UITableView委托和数据源连接到第一个ViewController。一切都在工作,除了当我点击一个细胞,有时我必须点击它两次才能触发Segue。
下面是我的didSelectRowAtIndexPath
函数:
func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
println("You clicked on \(indexPath.row) row")
self.performSegueWithIdentifier("homeToDetail", sender:self)
}
我的打印总是返回正确的indexPath。是视图层次结构问题还是其他问题?
谢谢JD
发布于 2017-06-13 15:28:45
你必须打电话给[tableView deselectRowAtIndexPath:indexPath animated:YES];
来解决这个问题
https://stackoverflow.com/questions/27906793
复制相似问题