前回の記事「UITableViewCell の背景を画像にする」では、UITableViewCell とそれに乗った UILabel の背景色が意図せずに変わってしまう現象を紹介しました。 UITableViewCell の背景色を任意の色にしたい場合も、同じ原因で意図した色にならない問題に遭遇することがあります。 今回は、前回のおさらいをしながら、セルの背景色が交互に替わるテーブルビューを作りたいと思います。 以下のコードは、UITableView の dataSource オブジェクトが UITableViewCell を返すところです。 - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { // Assure cell UITab
![UITableViewCell の背景色を変える](https://cdn-ak-scissors.b.st-hatena.com/image/square/f48bb5eb69e2bbc47f927e37bf94651560c96051/height=288;version=1;width=512/https%3A%2F%2Frunlooprun.files.wordpress.com%2F2010%2F12%2Fstriped_landscape.png)