UILabel 自动换行

来源:互联网 发布:诺基亚e5 00软件下载 编辑:程序博客网 时间:2024/05/17 22:20


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

    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?";

    //清空背景颜色

    label.backgroundColor = [UIColorclearColor];

    //设置字体颜色为白色

    label.textColor = [UIColorwhiteColor];

    //文字居中显示

    label.textAlignment =UITextAlignmentCenter;

    //自动折行设置

    label.lineBreakMode =UILineBreakModeWordWrap;

    label.numberOfLines =0;


0 0
原创粉丝点击