2017-11-27 13 views
-3

コードをSwift 4にアップグレードした後、すべてのtableView関数のコンソールでこの警告が表示されました。あなたが使うすべてののtableView関数の先頭に「@objc」を追加する必要があり、この警告を修正するにはtableview関数の「推奨されなくなり、Swift 4で削除されます」という警告が表示される

tableView:willDisplayCell:forRowAtIndexPath:] is deprecated and will be removed in Swift 4; add explicit '@objc' to the declaration to emit the Objective-C entrypoint in Swift 4 and suppress this message 

tableView:cellForRowAtIndexPath:] is deprecated and will be removed in Swift 4 

答えて

-2

。あなたは間違いなく、データソースとデリゲートに関するしている場合

func tableView(_ tableView: UITableView, willDisplay cell: UITableViewCell, forRowAt indexPath: IndexPath) { 
} 

を表示している細胞を同定するための1以下cellForRow

func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { 
} 

使用のためのコードの下

@objc func tableView(_ tableView: UITableView!, numberOfRowsInSection section: Int) -> Int { 
    return 1 
} 
0

を使用:このように

関数はUITableViewDataSourceまたはUITableViewDelegateを選択し、右あなたの機能を得るためにつながる定義へのジャンプをクリックしてください。

希望すると便利です

関連する問題