tags:

views:

33

answers:

2

Is this possible to achieve something like that on iOS simply using UILabel + UIView ?

I've tried using a UIWebView but it's too slow to be used in a UITableView.

That style using UILabel ?

A: 

Something like this

lbl.backgroundColor = [UIColor redColor];
lbl.textColor = [UIColor whiteColor];

Assuming lbl is a UILabel object.

Benj
This will add a rectangle red background. Not exactly what I'm looking for.
Pierre Valade
A: 
lbl.font = [UIFont boldSystemFontOfSize:20];
karim
What do you mean Karim ?
Pierre Valade
If you want to make such a text, you need to set it like this, (change text color, back ground color and font size). lbl.backgroundColor = [UIColor redColor];lbl.textColor = [UIColor whiteColor];lbl.font = [UIFont boldSystemFontOfSize:20];IF the string is not of same length, you can set the Font Size in IB to "Adjust to fit", or lbl.adjustsFontSizeToFitWidth = YESOR, you can change the label frame size with string size. You can get the current string length in pixel using NSString.sizeWithFont method in UIKit framework.
karim