如何在多个UITableViewCell
子类中共享一个xib
?使用相同xib的多个UITableViewCell子类?
它们都具有相同的视图界面,所以我不想为了更改单元类而多次复制相同的xib
。
- (void)viewDidLoad
{
[super viewDidLoad];
[self.tableView registerNib:[UINib nibWithNibName:@"BaseCell" bundle:[NSBundle mainBundle]] forCellReuseIdentifier:@"BaseCell"];
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
BaseCell *baseCell = [tableView dequeueReusableCellWithIdentifier:@"BaseCell" forIndexPath:indexPath];
...
我所需要的,而不是在这里是一个实例我ChildCell
- 这是BaseCell
一个子类。有任何想法吗?
改变类的结构可能是更好的方法。根据细胞的当前状态添加细胞状态和响应是另一种选择。 – meth