ios iphone UILabel 多行文字自动换行 (自动折行)

来源:互联网 发布:如何投资知乎 编辑:程序博客网 时间:2024/04/29 02:56
  1. UIView *footerView = [[UIView alloc] initWithFrame:CGRectMake(10100300180)];  
  2.     UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(10100300150)];  
  3.     label.text = @"where are you? where are you? where are you? where are you? where are you? where are you? where are you? where are you? where are you? where are you?";  
  4.     //清空背景颜色  
  5.     label.backgroundColor = [UIColor clearColor];  
  6.     //设置字体颜色为白色  
  7.     label.textColor = [UIColor whiteColor];  
  8.     //文字居中显示  
  9.     label.textAlignment = UITextAlignmentCenter;  
  10.     //自动折行设置  
  11.     label.lineBreakMode = UILineBreakModeWordWrap;  
  12.     label.numberOfLines = 0;