I have designed a cell in storyboard, then created a custom UITableViewCell subclass (BasicCell) and assigned it to it. Also set the proper identifiers. I created outlets of the custom cell in that class. Then in my UITableViewController subclass (where I have two types of prototype cells), the cells content won't show up. What am I doing wrong?
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";
}
}