1. TableViewに背景画像を表示させる場合。
UIColor *col = [[UIColor alloc] initWithPatternImage:[UIImage imageNamed:@"background.png"]];
[tableView setBackgroundColor:col];
[col release];
2. TableViewCellに背景画像を表示させる場合。
UIImageView *backgroundView = [[UIImageView alloc] init];
backgroundView = [UIImage imageNamed:@"background.png"]];;
cell.backgroundView = backgroundView;
TableView、TableViewCellに背景画像を表示した場合、デフォルトだとセルのテキストは白色のままなので、CellのtextLabelの背景画像にClearColorを設定して、セルのテキストラベルにも背景画像が表示されるようにする。
cell.textLabel.backgroundColor = [UIColor clearColor];
■参考記事
http://q.hatena.ne.jp/1278411224
タグ:iPhone