2009-06-22 48 views

回答

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 

的图案可以由多个图案的颜色之间的切换进行动画处理。我已经在图案图像和纯色之间以> 30fps翻转,iPhone设备保持良好状态。

只要图像拼贴很小,我没有看到任何理由不这样做,但我没有广泛地描述它。

+0

随着字体大小变得更大,这种填充颜色变得捉襟见肘,缩小比例,有什么想法如何解决这个问题? – jjxtra 2012-08-18 04:05:21

相关问题