UITableView UITableViewCell not reloading on reloadData

Posted by David van Dugteren on Stack Overflow See other posts from Stack Overflow or by David van Dugteren
Published on 2010-06-03T02:44:59Z Indexed on 2010/06/03 2:54 UTC
Read the original article Hit count: 1052

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.

© Stack Overflow or respective owner

Related posts about uitableview

Related posts about cache