UILabel中的文本可以分配colorWithPatternImage:吗?

wil*_*lc2 3 iphone image iphone-sdk-3.0

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

有没有理由不这样做?内存使用情况等?

wil*_*lc2 6

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

alt text 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
Run Code Online (Sandbox Code Playgroud)

可以通过在多种图案颜色之间切换来动画化图案.我在> 30fps的图案图像和普通颜色之间翻转,iPhone设备保持良好状态.

只要图像图块很小,我就没有任何理由不这样做,但我没有广泛地描述它.