UITableview titleForHeaderInSection not displaying correctly

Posted by mjdth on Stack Overflow See other posts from Stack Overflow or by mjdth
Published on 2010-03-02T04:16:49Z Indexed on 2010/03/11 19:44 UTC
Read the original article Hit count: 445

I have some VERY simple code to return the title for a section header:

- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section {
    if (section==0) {
        return @"";
    } else if (section==1) {
        return @"Actions";
    } else if (section==2) {
        return @"Attached To";
    }

    return @"";
}

For some reason when the headers are actually displayed on the simulator, half of the time they're simply the first letter and then ellipses. Scrolling up and down (to refresh the header view most likely) will result in the title showing correctly roughly half the time and showing incorrectly the other half of the time.

Do anyone have any idea what could be causing this? I think this is more of a recent development, but it seems to happen in almost all UITableViews in my application. I don't want to say this is a 3.2 issue, but it might have started happening around then, but either way it must be related to the code somehow. Thank you.

© Stack Overflow or respective owner

Related posts about uitableview

Related posts about iphone