11月 21 2009

テキストをプログラムで調整する。

Posted by dos in iphone, iphone Tips

テキストをプログラムで調整する方法の一例を記述したいと思います。

UILabel *label;

//配置座標と範囲

label = [[UILabel alloc] initWithFrame:CGRectMake(170.0f, 372.0f, 135.0f, 20.0f)];

//背景のアルファ値を0.0にする

label.backgroundColor = [UIColor clearColor];

//フォントサイズ

label.font = [UIFont systemFontOfSize:14];

//テキストを右字詰め

labele.textAlignment = UITextAlignmentRight;

//RGBとアルファ値を調整

label.textColor = [[UIColor alloc] initWithRed:0.3 green:0.3 blue:0.3 alpha:1.0];

と記入する。 Read entire article.