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

+0

@PsychoDadはテクスチャ画像のサイズを変更するだけです。 –

関連する問題