Я разработал ячейку в раскадровке, затем создал собственный подкласс UITableViewCell (BasicCell) и назначил его ему. Также установите правильные идентификаторы. Я создал розетки пользовательской ячейки в этом классе. Затем в моем подклассе UITableViewController (где у меня есть два типа ячеек-прототипов) содержимое ячеек не будет отображаться. Что я делаю не так?
BasicCell.h
@interface BasicCell : UITableViewCell
@property (strong, nonatomic) IBOutlet UILabel *scorevalue;
@property (strong, nonatomic) IBOutlet UILabel *avgvalue;
@property (strong, nonatomic) IBOutlet UILabel *rankvalue;
@property (strong, nonatomic) IBOutlet UILabel *scorelabel;
@property (strong, nonatomic) IBOutlet UILabel *categorylabel;
@property (strong, nonatomic) IBOutlet UILabel *ranklabel;
@end
TableViewController.m
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifierBasic = @"basic";
static NSString *CellIdentifierDetailed = @"detailed";
UITableViewCell *cell;
if(indexPath.row==0){
// Create first cell
cell = [[BasicCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifierBasic];
}
else{
// Create all others
cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifierDetailed forIndexPath:indexPath];
}
// Configure the cell...
switch ([indexPath row])
{
case 0:
{
BasicCell *basicCell = (BasicCell *)cell;
basicCell.scorelabel.text = @"test";
basicCell.categorylabel.text = @"test";
basicCell.ranklabel.text = @"test";
basicCell.scorevalue.text = @"test";
basicCell.avgvalue.text = @"test";
basicCell.rankvalue.text = @"test";
}
}