小编Dup*_*ups的帖子

如何引用cellForRowAtIndexPath之外的单元格

我正在尝试更新外部单元格中的标签

override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell
Run Code Online (Sandbox Code Playgroud)

通过使用

let cell = tableView.dequeueReusableCellWithIdentifier("cell", forIndexPath: indexPath) as! Cell
Run Code Online (Sandbox Code Playgroud)

在另一个功能.但是,我一直在收到错误.因此,我试图通过使用来引用单元格let cell = Cell(),但是我得到了错误unexpectedly found nil.最后,我试过了

let cell = tableView.dequeueReusableCellWithIdentifier("cell") as! Cell
Run Code Online (Sandbox Code Playgroud)

但不会返回错误,但标签cell.time.text不会更新.

xcode uitableview ios swift

6
推荐指数
2
解决办法
1万
查看次数

标签 统计

ios ×1

swift ×1

uitableview ×1

xcode ×1