Hey idk if I am doing something wrong or if I should file a bug report for this.
I initiate UI elements to my main viewcontroller like the following:
knob[7] =[[UIImageView alloc] initWithFrame:CGRectMake(a, b, c, d)];
knobS[7] =[[knobBand alloc] initWithFrame:CGRectMake(a, b, c, d)];
knob[8] =[[UIImageView alloc] initWithFrame:CGRectMake(a, b, c, d)];
Then I do
[self.view addSubview:knobS[7]];
[knob[7] setImage:[UIImage imageNamed:@"knob"]];
[knob[8] setImage:[UIImage imageNamed:@"knob"]];
[self.view addSubview:knob[7]];
[self.view addSubview:knob[8]];
If I put the [self.view addSubview:knobS[7]];
below the other 4 lines, the knob[7]
and knob[8]
will not show up at all, although they are the same size and only knob[7]
is covered by knobS[7]
. I thought this is some programming mistake so I didn't investigate this any further because putting said line above the 4 lines worked - until I built the project the third time and this is where it's getting weird:
Now, whenever I build, build&clean, clean&build, ... the project, one of these 3 things happen:
- Only
knobS[7]
is showing - All 3 UI elements are showing
- the project builds but when launching it throws EXC_BAD_ACCESS at the
setImage:
line
And the amount of occurrences is pretty accurately summed up by the order; 1. is happening 60% of the times, 2. 30% and case 3 is happening in 1 out of 10 cases.
I tried rebooting and there isn't a single line of code grabbing the current time or a random value which might affect the outcome of the code. Even after hitting CMD+R twice within 10 sec without changing ANY code I get 2 different results.
Is there any other form of cleaning/building a project which might help here?
EDIT: This behavior is somehow not reproducible in Xcode 7, it's only 6 that causes the problems.