This is my cellForRowAtIndexPath function. I could not get the setText to the label to work. Can you please help me out?
// Customize the appearance of table view cells. - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"Cell";
UILabel *messageLabel = nil;
int row = [indexPath row];
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[UITableViewCell alloc] initWithFrame:CGRectMake(0, 0, 320, ROWHEIGHT) reuseIdentifier:CellIdentifier];
messageLabel = [[UILabel alloc] initWithFrame:CGRectMake(60, 5, 240, 60)];
[messageLabel setFont:[UIFont fontWithName:@"ArialMT" size:12]];
[messageLabel setTextColor:[UIColor blackColor]];
[messageLabel setBackgroundColor:[UIColor clearColor]];
[messageLabel setNumberOfLines:3];
[messageLabel setLineBreakMode:UILineBreakModeWordWrap];
[messageLabel setTag: messageTag];
[cell.contentView addSubview:messageLabel];
}
else{
messageLabel = (UILabel *)[cell viewWithTag:messageTag];
}
[messageLabel setText:[[[aSingleton wallItemArray] objectAtIndex:row] message]];
NSLog(@" -- > at row %d, message: %@", row, [[[aSingleton wallItemArray] objectAtIndex:row] message]);
return cell;
}