カスタム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
ペン先に接続する方法はありますか?