didSelectRowAtIndexPathの2つの点滅画像でtableviewcellの背景画像をアニメーション化したい。次のコードを使用できますが、背景に 1 つの画像が表示されます。ただし、点滅するgifのような画像が必要です。
cell.backgroundView = [ [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"correctAnswer.png"]]autorelease];
didSelectRowAtIndexPathの2つの点滅画像でtableviewcellの背景画像をアニメーション化したい。次のコードを使用できますが、背景に 1 つの画像が表示されます。ただし、点滅するgifのような画像が必要です。
cell.backgroundView = [ [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"correctAnswer.png"]]autorelease];
UIImageView には、animationImages
プロパティを使用してアニメーションを実行する機能があります。
UIImageView* imgView = [[[UIImageView alloc] init] autorelease];
imgView.animationImages = [NSArray arrayWithObjects:
[UIImage imageNamed:@"correctAnswer1.png"],
[UIImage imageNamed:@"correctAnswer2.png"], nil];
imgView.animationDuration = 0.5;
cell.backgroundView = imgView;
[imgView startAnimating];
アニメーションの各フレームをプロジェクトに含める必要があります。
また、UITableViewCell
の imageView プロパティを使用した方がよいのではないでしょうか? そうすれば、セルの左側にアニメーションが表示され、テキストやセルの他の部分に干渉することはありません...