UITableViewCellサブクラスを作成しました。現在、それを使用していますHomeViewControllerクラスでは、私はこれを行う:IBでUITableViewCellサブクラスを再利用する方法
@interface: (for HomeViewController)
@property (nonatomic, assign) IBOutlet UITableViewCell *customCell;
@implementation:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CustomTableViewCellIdentifier = @"CustomTableViewCellIdentifier";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CustomTableViewCellIdentifier];
if (cell == nil) {
UINib *cellNib = [UINib nibWithNibName:@"CustomTableViewCell" bundle:nil];
[cellNib instantiateWithOwner:self options:nil];
cell = self.customCell;
self.customCell = nil;
}
NSUInteger row = [indexPath row];
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
return cell;
}
をCustomTableViewCell.xibでは、私のファイルの所有者はHomeViewControllerであり、私はCustomTableViewCellへのファイルの所有者からコンセントを接続します。そのすべてがうまく動作します。
今、このセルを使用するために、DetailViewControllerという別のUIViewControllerのサブクラスを追加したいと思います。 My Fileの所有者オブジェクトは既に使用されています。私はこのセルを再利用するために他のオブジェクトを作成することに精通していません。誰かがこのシナリオで何をする必要があるのか説明できますか?ありがとう。