1

I have a UITableViewCell in my project that I want to reuse in a few UITableViews. Is there a way to reuse them without setting up UILabels, etc each time in the Storyboard?

Brian Kalski
  • 897
  • 9
  • 35

2 Answers2

0

In cellForRowAtIndex, you can refer to the custom cell:

- (UITableViewCell *)tableView (UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
CustomCell *cell = ...
cell.labelName.text = ...;
Return cell;

}

Aadesh
  • 162
  • 1
  • 8
0

You need to create your UITableViewCell class and register it for your tables

- (void)viewDidLoad
{
    [super viewDidLoad];
    [self.tableView registerClass:<RegisteredClass> forCellReuseIdentifier:<ReuseIdentifier>];
}
LLIAJLbHOu
  • 1,313
  • 12
  • 17