3

如果是这样,图像可以动画吗?

有充分的理由不这样做吗?内存使用等?

4

1 回答 1

6

是的,标签可以有图案颜色。

替代文字 http://img178.imageshack.us/img178/1995/textwithpatterncolor.png

// make a UIColor with an image as the pattern
UIImage *tileImage = [UIImage imageNamed:@"hot_grad_64px.png"];
UIColor *patternColorTile = [UIColor colorWithPatternImage:tileImage];

// assign it to the .textColor property of a UILabel
self.testLabel.textColor = patternColorTile;

// the pattern will only align if both the .frame property of the 
// label AND the font size is the same as the image tile height

可以通过在多种图案颜色之间切换来为图案设置动画。我以 > 30fps 的速度在图案图像和纯色之间切换,并且 iPhone 设备保持正常。

只要图像块很小,我看不出有什么理由不这样做,但我没有对它进行广泛的分析。

于 2009-09-08T02:46:06.737 回答