2016-09-30 8 views
1

次のコードを記述しました。私はそれが機能のように動作するようにしようとしていますUIBarButtonItemアイテムの機能を編集する代わりに私はカスタムナビゲーションバーを持っているのでUIButtonを使用していますが、いくつかのコンパイルエラーがあります。この関数は、ボタンが押されたときに編集を許可し、再度押されたときに編集を終了するはずです。iOS swift 3 UIBarButtonの代わりにUIButtonを使用するテーブルビューの編集ボタン

@IBAction func edit(sender: UIButton){ 
    if [tableView.isEditing] == YES { 
     [self.tableView .setEditing(false, animated: false)] 
    } 
    else{ 
     [self.tableView .setEditing(true, animated: true)] 
    } 
} 

答えて

1

あなたはスウィフトを混合し、Objective-Cのコードだが、愚かな私:(この

@IBAction func edit(sender: UIButton) { 
    if tableView.isEditing { 
     tableView.setEditing(false, animated: false) 
    } else{ 
     tableView.setEditing(true, animated: true) 
    } 
} 
+0

ようになるはずです。本当にありがとうございました。 –

関連する問題