user2666897
user2666897

Reputation: 15

UILabel Clear Background

I've have a UIView which has several UIViews (view1-view10) and UILabels (label1-label3) as subviews. label 2 is on top of view 3, and I have set label2's background color to clear, but I still get a white box around the label2 which blocks off some of my view 3. How do I set it up so that the non text area is clear? I took a screenshot and posted here:

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];

Upvotes: 0

Views: 699

Answers (2)

Bhavesh Nayi
Bhavesh Nayi

Reputation: 3656

[self.view bringSubviewToFront:label];

Upvotes: 0

Douglas Fischer
Douglas Fischer

Reputation: 535

Also, be sure the opaque property of this label is NO.

Upvotes: 3

Related Questions