iphone - 什么是 -[UITableViewDelegate willDisplayCell :forRowAtIndexPath:] for?

标签 iphone uitableview

在我所有的 UITableView 编程中,我总是在 -[UITableViewDataSource tableView:cellForRowAtIndexPath:] 中配置我的 UITableViewCells。现在我遇到了 -[UITableViewDelegate willDisplayCell:forRowAtIndexPath:] 方法。这似乎也是进行单元配置的合适位置。

我的问题是:这两种方法之间合适的“分工”是什么?在其中一个与另一个之间我应该做什么?

最佳答案

您可以使用它来配置字体和文本颜色等内容。在较新版本的 iPhone 中,对于某些表格配置,如果您在 tableView:cellForRowAtIndexPath: 方法中配置诸如标签文本颜色之类的内容,则您的更改将在单元格实际生效之前的某个时刻丢失。显示。在这里您可以执行诸如更改标签颜色、调整背景突出显示等操作。

关于iphone - 什么是 -[UITableViewDelegate willDisplayCell :forRowAtIndexPath:] for?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1890265/

相关文章:

ios - ADInterstitialAd 不适用于 ipad swift

iphone - iPhone 中的 Dropbox Api

iphone - 使用相同的指针指向不同的UIViewController

ios - UITableView 使用 beginUpdates()/endUpdates()/performBatchUpdates() 意外反弹

ios - 试图从 UITableView 返回选定的单元格,但它只返回 nil

cocoa-touch - UISearchBar 未出现

ios - 选择时 uitableviewcell 损坏(从底部看到)

iphone - 根据该单元格中数据的属性值仅删除特定的 UITableViewCell

iphone - 如何在 iPhone 的 OpenGLES 中获取中点值?

iphone - 如何使 UITableView 中的第一列不在 iPhone Objective-C 中水平滚动?