I got a requirements to display a UILabel with background split between two colors, like in this image:

(colors here are black at the bottom and 50% gray at the top – but this is not important). I tried setting the label’s background colour to 50% grey in the interface builder and then do this in the code:
CALayer *sl1 = [[[CALayer alloc] init] autorelease];
sl1.frame = CGRectMake(0, lbl.frame.size.height / 2, lbl.frame.size.width, score1.frame.size.height/2);
sl1.backgroundColor = [[UIColor blackColor] CGColor];
[lbl.layer insertSublayer:sl1 atIndex:0];
Unfortunately, this resulted in the black part being drawn over the text, so the label looks like this:

which is, needless to say, is not something I need. So how can I get this background without turning to custom images? The issue is I need to have UILabel‘s like this in several places, different sizes – so I would need to create multiple versions of the background image.
Any ideas? Thanks.
this works: