Q:

Make UILabel look like CSS display: inline

Ok, here’s my problem.  I have a rather large set of UIButtons that have a UIImage set as a background.  Now I want to add labels inside those buttons.  But the design I’m currently implementing uses “fancy” labels where the background color of the label is semi transparent and collapses around the text. 
My first idea was to use a UIWebview to make that happen and it works, but adding a lot of UIWebview’s takes a really long time for the labels to show up. 
Next solution would be to use an UILabel and the performance is times better.  But for the life of me, I cannot figure out, how to get the visual style to match the design. 
So basically I’m looking to make an UILabel behave like an HTML element that has as CSS rule display: inline; style defined. 
Is this even possible with the built-in parameters of an UILabel?  If not, I’m probably going to use the UIWebView solution, but it would be of course much niftier to use the UILabel’s. 
Here’s a screenshot that should explain it somewhat better 
Top is how the default UILabel acts and bottom is how I want it to act. 

A:

I’ve managed to find a solution that almost works as intended.  It doesn’t collapsed around all the single lines, but it collapses the box around the text and that,s good enough for me at the moment. 
Here’s the final code that does the trick for me:
UILabel *buttonTitle = [[UILabel alloc] initWithFrame:CGRectMake(4, 4, 176, 120)];
buttonTitle.text = @"Button text";
buttonTitle.backgroundColor = [UIColor colorWithRed:0 green:0 blue:0 alpha:0.65];
buttonTitle.textColor = [UIColor whiteColor];
buttonTitle.textAlignment = UITextAlignmentLeft;
buttonTitle.numberOfLines = 0;
buttonTitle.lineBreakMode = UILineBreakModeWordWrap;
buttonTitle.adjustsFontSizeToFitWidth = NO;
[buttonTitle sizeToFit];

