Ios 如何使用现有的Xib文件对UITableViewCell进行子类化

Ios 如何使用现有的Xib文件对UITableViewCell进行子类化,ios,objective-c,uitableview,ios8,Ios,Objective C,Uitableview,Ios8,对具有附加Xib文件的UITableViewCell的现有子类进行子类化的正确方法是什么。如何对UITableViewCell子类进行子类化,并在新类中仍然使用Xib?您需要做的就是使用相同的标识符,例如 - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { CustomCell *cell = [tableView dequeue

对具有附加Xib文件的UITableViewCell的现有子类进行子类化的正确方法是什么。如何对UITableViewCell子类进行子类化,并在新类中仍然使用Xib?

您需要做的就是使用相同的标识符,例如

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
     CustomCell *cell = [tableView dequeueReusableCellWithIdentifier:@“ExistingCellIdentifier"];
     if (cell == nil) {
          cell = [[CustomCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:@“ExistingCellIdentifier"];
     }

     return cell;
}
希望这对您有所帮助,如果您有任何问题,请提交,祝您好运