iOS開發之UIlabel多行文字自動換行 (自動折行)

UIView *footerView = [[UIView alloc]initWithFrame:CGRectMake(10, 100, 300, 180)];字體

UILabel *label = [[UILabel alloc]initWithFrame:CGRectMake(10, 100, 300, 150)];spa

label.text = @"Hello world! Hello world!Hello world! Hello world! Hello world! Hello world! Hello world! Hello world!Hello world! Hello world! Hello world! Hello world! Hello world! Helloworld!";it

//背景顏色爲紅色im

label.backgroundColor = [UIColor redColor];co

//設置字體顏色爲白色time

label.textColor = [UIColor whiteColor];background

//文字居中顯示居中

label.textAlignment = UITextAlignmentCenter;顏色

//自動折行設置ab

label.lineBreakMode = UILineBreakModeWordWrap;

label.numberOfLines = 0;

相關文章
相關標籤/搜索