iOS —label自动换行

来源:互联网 发布:淘宝尺码表格怎么做 编辑:程序博客网 时间:2024/05/29 07:36
  UILabel *label = [[UILabel alloc]initWithFrame:frame];    label.text = tileName;    //背景颜色为红色    label.backgroundColor = [UIColor redColor];    //设置字体颜色为白色    label.textColor = [UIColor whiteColor];    //文字居中显示    label.textAlignment = UITextAlignmentCenter;    //自动折行设置    label.lineBreakMode = UILineBreakModeWordWrap;    label.numberOfLines = 0;    [self.collectionView addSubview:label];

0 0
原创粉丝点击