UITableView 行单元控制器

发布于 2024-11-10 09:36:48 字数 244 浏览 8 评论 0原文

我的第一篇文章(所以请耐心等待)。

我正在建立一个 UITableView 组。每个部分都定义并存储在名为 TableViewSectionClass 的对象中。

不同部分的行会使用UITableCell的不同子类来使各个部分中的行显示不同。即一个部分中一行,另一部分中两行,另一部分中两行带有图像。

如何在 TableViewSectionClass 中存储“创建特定类型的行单元格所需的 UITableCell 类类型”?

My first post ever (so please be patient).

I am building a group UITableView. Each section is defined and stored in an object called TableViewSectionClass.

The rows is different section will use different sub-classes of UITableCell to make the rows in various sections display differently. I.e. One line in one section, two in another, two with an image in another.

How can I store the "UITableCell class type needed to create my particular kind of row cell" in my TableViewSectionClass?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

娇女薄笑 2024-11-17 09:36:48

您可以将其存储在 Class 类型的 property/ivar 中;您可以使用 class 类方法检索适当的类对象,当然,类似于 tableViewSectionClass.tableCellClass = [MyUITableCellClass class]

在调用类方法(例如 alloc)时,您可以像使用裸类名一样使用此类对象:[[self.tableCellClass alloc] initWithStyle:...reuseIdentifier:[self.tableCellClass description]]

You can store it in a property/ivar of type Class; you retrieve the appropriate class object using the class class method, of course, something like tableViewSectionClass.tableCellClass = [MyUITableCellClass class].

You can use this class object just as you would a bare class name when calling class methods such as alloc: [[self.tableCellClass alloc] initWithStyle:... reuseIdentifier:[self.tableCellClass description]].

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文