gpt4 book ai didi

ios - 如何快速编写 [UITableViewCell 类]?

转载 作者:搜寻专家 更新时间:2023-11-01 06:45:35 25 4
gpt4 key购买 nike

在 Objective-c 中,我们可以像这样为 UITableView 注册类:

[self.tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:@"cellIdentifier"];

但是我不能在 Swift 中编写 UITableViewCell 类。那么如何在 swift 中编写 [UITableViewCell class] 呢?

最佳答案

您可以这样做来注册您的类(class):

self.tableView.registerClass(UITableViewCell.self, forCellReuseIdentifier: "cellIdentifier")

关于ios - 如何快速编写 [UITableViewCell 类]?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31264564/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com