2017-04-12 4 views
-3

私は "updateMapView(送信者:UIButton)"メソッドを呼び出すが、認識できないセレクタエラーを取得する次のメソッドがあります。私はアクションを設定しました:updateMapView:senderなどの他のバリエーションを持つ属性。それで問題はありません。それはどういうことでしょうか?私のコードで認識できないセレクターエラー?

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

メソッドの名前を 'func updateMapView(_ sender:UIButton)' – Callam

+0

に変更してください。http://stackoverflow.com/questions/24007650/selector-in-swiftと受け入れられた答え。 – rmaddy

答えて

0

それはfunc updateMapView(_ sender: UIButton)のように見えるように、あなたのメソッドの名前を変更し、あなたのアクションとして#selector(updateMapView)使用。

関連する問題