我正在尝试从按下的按钮捕获一个事件,所以我可以将它传递到表视图,它是一个计时器,我可以捕获时间并将其传递到tableview但我似乎无法捕获事件类型。
在下面的示例中,我可以捕捉目标得分的时间,但我需要将目标传递给tableview
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = UITableViewCell(style: UITableViewCellStyle.value1, reuseIdentifier: "cell")
cell.backgroundColor = self.view.backgroundColor
**cell.textLabel?.text = "Help here to capture the button event"**
cell.detailTextLabel?.text = time[indexPath.row]
return cell
}
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return time.count
}
@IBAction func goalClicked(_ sender: UIButton) {
let stopWatchString = stopWatch.elapsedTimeSinceStart()
stopwatchLabel.text = stopWatchString
time.insert(stopWatchString, at: 0)
self.tableView.reloadData()
}
由于
答案 0 :(得分:-1)
对它进行排序。
COUNT(CASE WHEN GOAL > 0 THEN 1 END)
然后在tableView
中var event: String!
最后在按钮功能
cell.textLabel?.Text = event