私のプロジェクトには、いくつかの UITableViews で再利用したい UITableViewCell があります。ストーリーボードで毎回 UILabels などを設定せずにそれらを再利用する方法はありますか?
2 に答える
0
UITableViewCell クラスを作成し、テーブルに登録する必要があります
- (void)viewDidLoad
{
[super viewDidLoad];
[self.tableView registerClass:<RegisteredClass> forCellReuseIdentifier:<ReuseIdentifier>];
}
于 2015-02-19T18:13:56.017 に答える
0
cellForRowAtIndex では、カスタム セルを参照できます。
- (UITableViewCell *)tableView (UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
CustomCell *cell = ...
cell.labelName.text = ...;
Return cell;
}
于 2015-02-19T18:11:37.630 に答える