0

コードの関連部分は - にありtableView:cellForRowAtIndexPath:ます。

cell.textLabel.backgroundColor = [UIColor clearColor];
if (indexPath.row == 0) {
   cell.backgroundView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:[NSString stringWithFormat:@"%d.jpg",result.level]]];
} else {
   cell.backgroundView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:[NSString stringWithFormat:@"%d.jpg",indexPath.row+OFFSETTOFIRSTROW]]];
}
cell.backgroundView.alpha = 0.5;
cell.backgroundColor = [UIColor darkGrayColor];
if (totalPieces) {
   cell.textLabel.textColor = [UIColor colorWithRed:0.1 green:0.5 blue:0.1 alpha:1.0];
   cell.textLabel.shadowColor = [UIColor blackColor];
   if (indexPath.row == 0) {
      cell.textLabel.shadowColor = [UIColor colorWithRed:0.0 green:0.5 blue:0.0 alpha:1.0];
      cell.textLabel.textColor = [UIColor yellowColor];
      cell.backgroundView.alpha = 1.0;
   }
   cell.textLabel.shadowOffset = CGSizeMake(1.0, 1.0);
} else {
   cell.textLabel.textColor = [UIColor blackColor];
   cell.textLabel.shadowColor = nil;
}

基本的に、テーブルの各行には独自の背景画像があります。これは iOS6 では正しく表示されます。しかし、iOS7 では、画像が背景色のように見えるもので覆われてしまいます。つまり、ユーザーがテーブルをスクロールするまでです。ユーザーがテーブルをスクロールすると、適切に表示されます。最初のプレゼンテーションで動作が異なる原因は何ですか? 修正するにはどうすればよいですか?

意図した結果は、セル全体を覆う濃い灰色の背景色です。その上には、背景色が表示される透明度のある背景画像があります。その上にはテキストがあり、背景が透明なので、画像/セルの背景が透けて見えます。

他に何か聞こえない限り、セルの背景を使用する代わりに、2 つの画像を重ねることになると思います。

4

3 に答える 3

1

最初にセルの背景ビューを nil に設定してクリアします。次に、カスタム ビューを設定します。

[cell setBackgroundView: nil];
UIView* bview = [[UIView alloc] init];
bview.backgroundColor = [UIColor colorWithPatternImage:@"your image"];
[cell setBackgroundView:bview];

これは私にとってはうまくいきました..あなたにもうまくいくことを願っています.. :-) 頑張ってください..

于 2013-10-30T06:15:37.170 に答える
0

これは Apple が意図した変更です。それを修正するには、に変更cell.backgroundColor[UIColor clearColor]ます。

于 2013-10-30T03:09:24.850 に答える