オーバーライドUITableViewDelegate
さんは、tableView:cellForRowAtIndexPath:
以下のコンパイルエラーの原因となっています。
セレクター 'tableView:cellForRowAtIndexPath:'でメソッドをオーバーライドすると、互換性のないタイプ '(UITableView!、NSIndexPath!)-> UITableViewCell!'
オーバーライド関数の現在の実装は次のとおりです。
override func tableView(tableView: UITableView!, cellForRowAtIndexPath indexPath: NSIndexPath!) -> UITableViewCell!
{
let cell = tableView.dequeueReusableCellWithIdentifier("cellIdent", forIndexPath: indexPath) as UITableViewCell
// Configure the cell...
return cell
}
エラーの原因とその修正方法を教えてください。
削除しますimplicit optional type
。チェックインUITableViewDataSource
にはオプションはありませんtableView
。indexPath
また、記述する必要のないメソッドをoverride
実装するときに削除します。protocol
override
以下の方法に置き換えてください
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell
//the error is on the line oboe... Overriding method with selector 'tableView:cellforRowAtIndexPath:'has incompatible type '(TableView, NSIndexpath) -. UITableViewCell!'
{
let cell = tableView.dequeueReusableCellWithIdentifier("cellIdent", forIndexPath: indexPath) as UITableViewCell
// Configure the cell...
return cell
}
この記事はインターネットから収集されたものであり、転載の際にはソースを示してください。
侵害の場合は、連絡してください[email protected]
コメントを追加