Unable to change background color of static table view cell on iOS 7 (iPad)

前端 未结 6 2140
礼貌的吻别
礼貌的吻别 2021-02-05 01:00

I am unable to change the background color of static UITableViewCells on iOS 7, when running on iPad device. You can easily check this with following setup:

  • Make a
6条回答
  •  鱼传尺愫
    2021-02-05 01:39

    There is a much easier way to override the cell background color. Subclass UITableViewCell and set it as the class for the static tableview cell. Then override:

    -(void) willMoveToSuperview:(UIView *)newSuperview  {
        self.backgroundColor = [UIColor ...];
    }
    

    where [UIColor ...] = whatever color you want (e.g. [UIColor clearColor] etc);

提交回复
热议问题