LoginSignup
29
27

More than 5 years have passed since last update.

UITableViewCellの背景色を変える

Posted at

UITableViewCellの背景色を変える方法です。

参考
UITableViewCell の背景色を変える

backgroundColorプロパティで変更しても変わりません。
UITableViewで、tableView: willDisplayCell: forRowAtIndexPath: を実装して、
その中でcell.backgroundColorで色を変更すると変わります。

- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath
{
    cell.backgroundColor = UIColor colorWithHue:0.61 saturation:0.09 brightness:0.99 alpha:1.0];
}
29
27
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
29
27