UITableView titleForHeaderInSection shows all caps

前端 未结 14 955
孤独总比滥情好
孤独总比滥情好 2021-01-30 16:28

I am using titleForHeaderInSection to show a header for a UITableView section. It worked fine with the iOS6 SDK, but the iOS7 SDK shows the header in all CAPS.

I guess

14条回答
  •  一个人的身影
    2021-01-30 17:00

    solution which i found is add Title in "titleForHeaderInSection" method

    - (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section {
       return @"Table Title";
    }
    

    and then call the willDisplayHeaderView method to Update :

    - (void)tableView:(UITableView *)tableView willDisplayHeaderView:(UIView *)view forSection:(NSInteger)section 
    {
        UITableViewHeaderFooterView *header = (UITableViewHeaderFooterView *)view;
        header.textLabel.textColor = [UIColor darkGrayColor];
        header.textLabel.font = [UIFont boldSystemFontOfSize:18];
        CGRect headerFrame = header.frame;
        header.textLabel.frame = headerFrame;
        header.textLabel.text= @"Table Title";
        header.textLabel.textAlignment = NSTextAlignmentLeft;
    }
    

提交回复
热议问题