2009-06-22 19 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

相關問題