UILabel
*label = [[UILabel
alloc]initWithFrame:CGRectMake(10,
100,
300,
150)];
label.text
= @"Hello
world!";
//背景顏色為紅色
label.backgroundColor
= [UIColor
redColor];
//設置字體顏色為白色
label.textColor
= [UIColor
whiteColor];
//文字居中顯示
label.textAlignment
= UITextAlignmentCenter;
//自動折行設置
label.lineBreakMode
= UILineBreakModeWordWrap;
label.numberOfLines
= 0;
//設置字體
label.font
=
[UIFont
fontWithName:@"Arial-BoldItalicMT"
size:32];
//設置陰影的顏色
label.shadowColor
= [UIColor blackColor]