2010-12-28 27 views
0

セルイメージをクリックしたときに変更しようとしています。"cell.selectedBackgroundView"のビューが表示されない

cell.backgroundView = [[[UIImageView alloc] init] autorelease]; 
cell.selectedBackgroundView = [[[UIImageView alloc] init] autorelease]; 

cell.textLabel.textColor = [UIColor colorWithRed:162.0/255.0 green:13.0/255.0 blue:20.0/255.0 alpha:1.0]; 
cell.textLabel.text = [channelCategories objectAtIndex:indexPath.row]; 

UIImage * backgroundImage = [UIImage imageNamed:@"topAndBottomRow.png"]; 
UIImage * selectionBackground = [UIImage imageNamed:@"topAndBottomRowSelected.png"]; 
cell.backgroundColor = [UIColor clearColor]; 
UIImage *indicatorImage = [UIImage imageNamed:@"indicator.png"]; 
cell.accessoryView = [[[UIImageView alloc] initWithImage:indicatorImage] autorelease]; 

cell.backgroundColor = [UIColor clearColor]; 
((UIImageView *)cell.backgroundView).backgroundColor = [UIColor clearColor]; 
((UIImageView *)cell.backgroundView).autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; 
((UIImageView *)cell.backgroundView).image = backgroundImage; 
((UIImageView *)cell.selectedBackgroundView).image = selectionBackground; 

私はこの問題をどのように助けてくれますか? ありがとうございます。

答えて

0

UIImageViewに型キャストしないでください。別のUIImageViewオブジェクトを割り当て、画像を設定してまたはcell.selectedBackgroundView

+0

に返信してください。私はまだその方法で試しても、私は取得していません。 – sny

+0

ねえ、それを手に入れました。私は何か他のところで間違えた。返信してくれてありがとう。 – sny

+0

ねえ、お元気ですか?私のテーブルビューでは、cell.backgroundViewまたはcell.selectedBackgroundViewの両方を別のイメージで使用したいと思っています。 cell.backgroundViewが必要ですが、テーブルの行を選択するとcell.selectedBackgroundViewは必要としません。 –

関連する問題