I would expect this code to produce the label test 5 times however it produces 5 labels, 4 of which just have 2 dots and the last one has the correct string test.
- (void)viewDidLoad
{
int n = 5;
int yValue = 100;
for(int i = 0; i < n; i++){
UILabel *label = [[UILabel alloc] initWithFrame: CGRectMake(0, yValue, 80, 44)];
label.text = @"text"; //etc...
[self.view addSubview:label];
yValue += 20;
}
[super viewDidLoad];
}
What am I doing wrong?
Height of label – 44. delta between labels – 20, less then 44. Set yValue+=44 and i think you will see mora than 2 dots. i think dots – top of ‘t’ letters.:)