我有以下方法调用“updateMapView(sender:UIButton)”方法,但是我得到了无法识别的选择器错误。我已经设置了action:属性以及其他变体,例如updateMapView:sender和stuff,所以这不是问题。可能是什么呢?
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
guard let cell = tableView.dequeueReusableCell(withIdentifier: MapsTableViewCell.reuseIdentifier, for: indexPath) as? MapsTableViewCell else {
fatalError("Unexpected Index Path")
}
let map = fetchedResultsControllerForMapEntity.object(at: indexPath)
// Configure Cell
cell.mapNameLabel.text = map.name
cell.button.accessibilityHint = map.name
cell.button.addTarget(self, action: "updateMapView:", for: .touchUpInside)
return cell
}
答案 0 :(得分:0)
重命名您的方法,使其看起来像func updateMapView(_ sender: UIButton)
并使用#selector(updateMapView)
作为您的操作。