Without any screenshot it is difficult to guess what type of overlapping you are referring to. And length of UILabel
does not help, either specify- width or height.
But if you are talking about width of UILabel
, then this piece of code may help you.
Lets you have three labels of different widths, which are in an array of widths array:{ 10, 20, 30}.
float width = [array objectAtIndex:0];
float x = 0.of;
float padding = 10.0f;
for(int i =0; i<3; i++){
UILabel *label = [UILabel alloc]initWithFrame:CGRectMake(x, y, width, height)];
[self.view addSubview: label];
x = x + width + paddng;
width = [array objectAtIndex:i + 1];
}