UITableViewCellにいい感じに背景画像を適用するライブラリ書いた。
UITableViewCellに簡単に背景画像を適用できるライブラリを作ったので紹介。
https://github.com/handlename/HNDecoratedTableView
対象のテーブルをHNDecoratedTableViewのインスタンスとして作り、
こういう背景画像を用意して、
tableView:willDisplayCell:forRowAtIndexPathをこんな感じで書くと、
-(void)tableView:(UITableView*)tableView willDisplayCell:(UITableViewCell*)cell forRowAtIndexPath:(NSIndexPath*)indexPath { [self.table setBackgroundImage:[UIImage imageNamed:@"cell_bg.png"] withInsets:UIEdgeInsetsMake(8, 8, 7, 7) forCell:cell forRowAtIndexPath:indexPath]; }
こんな感じに背景画像がつく。