2

カスタムUITableViewCellを xib ファイルからロードし、View Controller を所有者としてインスタンス化しました。

- (void)viewDidLoad {
    ...
    UINib *templateCellNib = [UINib nibWithNibName:@"TableViewCell" bundle:nil];
    UITableViewCell *_templateCell = [[templateCellNib instantiateWithOwner:self options:nil] firstObject];
    [self.tableView registerNib:templateCellNib forCellReuseIdentifier:_templateCell.reuseIdentifier];
}

すべて正常に動作しますが、 null であるため、実装File's Ownerの内部からビュー コントローラーにアクセスできません。TableViewCell

@interface TableViewCell ()

// File's Owner placeholder outlet
@property (weak, nonatomic) IBOutlet TableViewController *fileOwner;

@end

- (void)setUpCell {
    ...
    NSLog(@"File's Owner: %@", self.fileOwner); // outputs "File's Owner: (null)"
}

@end

File's Ownerプロパティが設定されていないのはなぜですか? そして、View ControllerをTableViewCellペン先に接続する方法はありますか?

4

0 に答える 0