UITableViewCell
nib からカスタム サブクラス化された s をロードしています。
私のView ControllerviewDidLoad
メソッドはregisterNib:forCellReuseIdentifier
. 私のView ControllerのcellForRowAtIndexPath
メソッドはdequeueReusableCellWithIdentifier
セルをロードするために使用しますが、セルを割り当て/初期化することはありません。
ビューコントローラー:
- (void)viewDidLoad
{
[super viewDidLoad];
[self.tV registerNib:[UINib nibWithNibName:@"VersatileIntTFCell" bundle:[NSBundle mainBundle]] forCellReuseIdentifier:kTFInt];
self.tV.delegate=self;
self.tV.dataSource=self;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"Int TextField";
VersatileIntTFCell *cell = (VersatileIntTFCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
return cell;
}
テーブル ビューは正常に表示され、セルは正常に表示されます。
今、私は のサブクラスを書き始めていますUITableViewCell
。私のサブクラスにはそれぞれ @property iVar があります (そうではありませんIBOutlets
)。init
サブクラスのメソッドでこれらを初期化したいのですUITableViewCell
が、それが呼び出されることはないようです。viewController でそれらを初期化できますが、cellForRowAtIndexPath
これは避けたいと思います。UITableViewCell
サブクラスでやりたい。これは可能ですか?もしそうなら、どのように/どこで/いつ?