I need to add a variable number of UIViews to a ViewController; the UIView contains a string that is drawn using CoreText. I am currently adding a single UIView by doing:
CGRect frame;
frame.origin.x = x;
frame.origin.y = y;
frame.size.width = 100;
frame.size.height = 100;
CTLabelView *label=[[CTLabelView alloc] initWithFrame:frame];
[label setLabelText:@"my string"];
I would like to avoid to specify the frame, letting the label to occupy the space it needs according to its length. Which is the best way to do it avoiding to specify width and height?