我通过代码执行了以下操作:
UILabel * label = [[UILabel alloc] initWithFrame:CGRectMake(40, 70, 300, 50)];
label.backgroundColor = [UIColor clearColor];
label.textAlignment = UITextAlignmentCenter; // UITextAlignmentCenter, UITextAlignmentLeft
label.textColor=[UIColor whiteColor];
label.text = @"Telechargez et consultez les catalogues et les tarifs de la gamme Audi au format PDF";
[self.view addSubview:label];
它看起来像this http://i56.tinypic.com/2w2oig9.png但我希望它看起来像this http://i51.tinypic.com/fxux50.png。如何更改标签的属性?
尝试这个:
UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(40, 30, 300, 50)];
label.backgroundColor = [UIColor clearColor];
label.textAlignment = NSTextAlignmentCenter;
label.textColor = [UIColor whiteColor];
label.numberOfLines = 0;
label.lineBreakMode = UILineBreakModeWordWrap;
label.text = @"Telechargez et consultez les catalogues et les tarifs de la gamme Audi au format PDF";
[self.view addSubview:label];
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)