UITableView UITableViewCell not reloading on reloadData
- by David van Dugteren
This question has been asked a few times now, but there exists no answer on the web that has solved the problem for me yet...
See the code:
{
const NSInteger TOP_LABEL_TAG = 1001;
static NSString *CellIdentifier = @"CellIdentifier";
UITableViewCell *cell = [theTableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
}
getAQuestionToAnswer = [[QuestionsToAnswer sharedInstance]
getLatestLoadedQuestion];
UILabel *topLabel;
topLabel = [[[UILabel alloc]
initWithFrame:
CGRectMake ( 50, 18, 260, 75)] autorelease];
[cell.contentView addSubview:topLabel];
topLabel.tag = TOP_LABEL_TAG;
topLabel.backgroundColor = [UIColor clearColor];
topLabel.textColor = [UIColor colorWithRed:0.25 green:0.0 blue:0.0 alpha:1.0];
topLabel.highlightedTextColor = [UIColor colorWithRed:1.0 green:1.0 blue:0.9 alpha:1.0];
[topLabel setFont:[UIFont fontWithName:@"MarkerFelt-Thin" size:13]];
topLabel.numberOfLines = 4;
topLabel = (UILabel *)[cell viewWithTag:TOP_LABEL_TAG];
topLabel.text = [NSString stringWithFormat:@"%@", [getAQuestionToAnswer valueForKey:@"question"] ];
Some code is omitted but the basics is there, I'm updating by means of a shake gesture, the NSLog confirms that the getAQuestionToAnswer is indeed updated with a new question after the gesture.
Yet at run time, no matter what I do... e.g. [self.tableview reloaddata]; nothing works.
It just doesn't want to refresh.