私のプロジェクトでは、静的セルを含む tableView と動的セルを含む tableView があります。カスタマイズするために、セル (グループ化されたスタイル) にグラデーションの背景を取得することができました。
行の位置 (Top、Bottom、Middle、または single) に応じて cellForRowAtIndex... で背景ビューを設定すると、動的な TableViews で問題なく動作します。
ただし、静的なテーブルビュー セルに実装しようとすると、機能しません。cellForRowAtindex を実装しようとしましたが、クラッシュします。
誰かがアイデアを持っていますか?
更新: cellForRow のコード..
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
UACellBackgroundView *bgw=[[UACellBackgroundView alloc]init];
if (indexPath.row==0) {
bgw.position = UACellBackgroundViewPositionTop;
cell.backgroundView=bgw;
}else if (indexPath.row==2){
bgw.position = UACellBackgroundViewPositionBottom;
cell.backgroundView=bgw;
}else {
bgw.position = UACellBackgroundViewPositionMiddle;
cell.backgroundView=bgw;
}
// cell.backgroundView=bgw;
return cell;
}
ちなみに、ここから取得した背景ビュー: http://code.coneybeare.net/how-to-make-custom-drawn-gradient-backgrounds とここ: http://pessoal.org/blog/2009 /02/25/customizing-the-background-border-colors-of-a-uitableview/
誰かが興味を持っている場合