Hi I have an requirement to customize UITableViewCell. Hence I have created a custom class and necessary UI (xib) to support it. For the XIB I have chosen the class as the derived class that I have created. My Problem is when after linking the display labels to the properties and me setting the values at runtime does not display the text desired. Its left as blank. Below is the code snippet.
@interface CustomCell : UITableViewCell
{
IBOutlet UILabel *titleRow;
}
@property (nonatomic, strong) UILabel *titleRow;
@property (nonatomic, strong) UILabel *subTitleRow;
@property (nonatomic, strong) UILabel *otherTextRow;
@end
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"MedVaultCell";
CustomCell *cell = nil;
cell = (CustomCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
// Configure the cell...
if (nil == cell){
//Load custom cell from NIB file
NSArray *nib = [[NSBundle mainBundle] loadNibNamed:@"CustomCellHistoryCell" owner:self options:NULL];
cell = [nib objectAtIndex:0];
//cell = [[CustomCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
//cell.accessoryType = UITableViewCellAccessoryDetailDisclosureButton;
}
// get the object
Weight *currentCellWeight = [_weights objectAtIndex:indexPath.row];
// Configure the cell...
UILabel *titleLable = [[UILabel alloc]init];
titleLable.text = currentCellWeight.customDispText;
[cell setTitleRow:titleLable];
cell.titleRow.text = currentCellWeight.display;
cell.titleRow.textColor = [UIColor redColor];
//cell.textLabel.text = [[_weights objectAtIndex:indexPath.row] customDispText];
//cell.textLabel.textColor = [UIColor whiteColor];
return cell;
}