我需要显示以下代码中附带的标签背景颜色。这是多线标签。
以下是代码段。
self._coverTittle =[[FontLabel alloc] initWithFrame:CGRectMake(100, 650, 400, 200) fontName:@"futurlig-webfont" pointSize:48.0f];
self._coverTittle.backgroundColor = [UIColor colorWithRed:0 green: 0 blue:0 alpha:0.4];
_coverTittle.numberOfLines = 5;
_coverTittle.textColor = [UIColor whiteColor];
self._coverTittle.tag=5;
[self._coverTittle sizeToFit];
答案 0 :(得分:0)
你做了什么应该工作:.backgroundColor。 如果你想要textcolor,你应该.textColor。 但你的问题有点不清楚,请澄清。
答案 1 :(得分:0)
self._coverTittle.backgroundColor = [UIColor colorWithRed:0 green: 0 blue:0 alpha:0.4];
如果要设置标签的背景颜色,则需要传递红色,绿色和蓝色部分的值。 以下链接包含相同的完整文档 - http://chris-software.com/index.php/tag/rgb-colors/