UILabel清除背景

时间:2013-08-19 00:50:14

标签: ios uiview uilabel

我有一个UIView,它有几个UIViews(view1-view10)和UILabels(label1-label3)作为子视图。标签2位于视图3的顶部,我已将label2的背景颜色设置为清除,但我仍然在label2周围有一个白色框,它阻挡了我的一些视图3.如何设置它以便非文字区域清楚吗?我拍了一张截图并张贴在这里:

enter image description here

UILabel * newLabel = [[UILabel alloc] initWithFrame:CGRectMake([[properties objectAtIndex:1] intValue], [[properties objectAtIndex:2] intValue], [[properties objectAtIndex:3] intValue], [[properties objectAtIndex:4] intValue])];
[newLabel setBackgroundColor:[UIColor clearColor]];
[self addSubview:newLabel];

2 个答案:

答案 0 :(得分:3)

另外,请确保此标签的opaque属性为NO。

答案 1 :(得分:0)

[self.view bringSubviewToFront:label];
相关问题