tintColorは生命の救済者であり、全く新しい(簡単な)レベルのテーマになっています。そのような単純なもののためのコアグラフィックスのためのああそうcool.No必要があるUIImageviewの色合いの色に応じてiOS 7のUIImageviewの新しいtintColorプロパティを画像のアニメーションに使用できますか?
//the life saving bit is the new UIImageRenderingModeAlwaysTemplate mode of UIImage
UIImage *templateImage = [[UIImage imageNamed:@"myTemplateImage"] imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate];
imageView.image = templateImage;
//set the desired tintColor
imageView.tintColor = color;
上記のコードは意志「ペイント」画像の不透明部分。
私が直面する問題は、アニメーションにあります。
上記のコードの続き:
//The array with the names of the images we want to animate
NSArray *imageNames = @[@"1",@"2"@"3"@"4"@"5"];
//The array with the actual images
NSMutableArray *images = [NSMutableArray new];
for (int i = 0; i < imageNames.count; i++)
{
[images addObject:[[UIImage imageNamed:[imageNames objectAtIndex:i]] imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate]];
}
//We set the animation images of the UIImageView to the images in the array
imageView.animationImages = images;
//and start animating the animation
[imageView startAnimating];
アニメーションが正しく行われているが、画像ではなく、UIImageViewのtintColorの元の色(GFX編集アプリケーションで使用される、すなわち色)を使用します。
私はアニメーションを自分自身で実行しようとしています(イメージをループし、UTImageViewのイメージプロパティをNSTimerディレイで設定して、人間の目でそれをキャッチできるようにします)。
これを行う前に、UIImageViewのtintColorプロパティが、私がそれを使ってやっていることをサポートしているかどうか、つまりアニメーションに使用するかどうかを質問したいと思います。
ありがとうございました。
私の答えを試してみて、それが助けかどうかを確認してください。 –
解決方法を見つけましたか? – Alf