Different cell bg color depending on iOS version (4.0 to 5.0)

后端 未结 6 1809
深忆病人
深忆病人 2021-01-02 07:51

I have a custom grouped UITableViewCell, with a couple of UILabels on it. Since the UITableViewCell background color used to be pure white, it matched the UILabels\' default

6条回答
  •  孤城傲影
    2021-01-02 08:26

    Nothing wrong with gcamp's answer, but if you'd prefer to keep the background white on both iOS4 and iOS5, then just do this:

    - (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath {
        [cell setBackgroundColor:[UIColor whiteColor]];
    }
    

提交回复
热议问题