Ответ 1
Во-первых, вам нужно создать класс для customCell, который наследуется от UITableViewCell. Теперь добавьте свойства, которые вы хотите использовать в своем customCell. В этом примере я добавил cellImage и cellLabel.
@property (nonatomic, strong) IBOutlet UILabel *cellLabel;
@property (nonatomic, strong) IBOutlet UIImageView *cellImageView;
После этого вам нужно связать UILabel и UIImageView с CustomCell с Nib.
Вам нужно добавить:
- (void)viewDidLoad
{
....
[self.tableView registerNib:[UINib nibWithNibName:@"xibName" bundle:nil] forCellReuseIdentifier:CellIdentifier];
.....
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"CustomCellReuse";
CustomCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[CustomCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
}
// Configure the cell...
[cell.cellImageView setImage:[UIImage imageNamed:@"whatever"]];
[cell.cellLabel setText = @"whatever"];
return cell;
}