开发者

UITableView row cell controllers

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 ro开发者_运维技巧w cell" in my TableViewSectionClass?


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]].

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜