在Swift中调用super for cellForRowAtIndexPath

use*_*808 9 uitableview swift

我非常感谢有人可以帮助我调用从内部super获取内容的语法.这是一个静态表.UITableViewCellfunc tableView (tableView: UITableView!, cellForRowAtIndexPath indexPath: NSIndexPath!)

override func tableView (tableView: UITableView!, cellForRowAtIndexPath indexPath: NSIndexPath!) -> UITableViewCell! {
//  The Objective-C code is: UITableViewCell *cell = [super tableView:tableView cellForRowAtIndexPath:indexPath];
var cell = super.??
}
Run Code Online (Sandbox Code Playgroud)

我已经尝试过,但似乎无法获得正确的语法.提前致谢.

Jos*_*man 16

var cell = super.tableView(tableView, cellForRowAt: indexPath)
Run Code Online (Sandbox Code Playgroud)

  • @huggie 这仅适用于界面构建器中定义的静态表视图。调用 super 将为您提供在 xib 文件中设置的静态单元格。 (2认同)