How to deal with the problem of incorrect color display caused by the overlap of two label

as shown in the figure: because label1 and label2 are in the same position, there will be a deviation in the upper label2 color display. Normally, it should be the label3 display effect
clipboard.png

.
    UILabel *label1 = [[UILabel alloc] initWithFrame:CGRectMake(50, 100, 100, 20)];
    label1.text = @"";
    label1.textColor = [UIColor redColor];
    [self.view addSubview: label1];
    
    UILabel *label2 = [[UILabel alloc] initWithFrame:CGRectMake(50, 100, 100, 20)];
    label2.text = @"";
    label2.textColor = [UIColor whiteColor];
    [self.view addSubview: label2];
    
    UILabel *label3 = [[UILabel alloc] initWithFrame:CGRectMake(150, 100, 100, 20)];
    label3.text = @"";
    label3.textColor = [UIColor whiteColor];
    [self.view addSubview: label3];
Ios
Mar.13,2021

if you want not to affect it, you should hide the underlying controls that should not be displayed

when it comes to the problem of layer, just like you draw a picture and put the same picture on it, your ideal situation is that two pictures overlap exactly the same as the same picture. In fact, this is not the case. Even the text drawn by the same text in the same coordinates will have a deviation. From your visual effects, the two pictures will at least be darker (brighter) when stacked together, not to mention the different colors.
more deeply related to GPU rendering, the electron beam keeps emitting the phosphor to make it glow, and then the screen is refreshed again and again, and the rest is given to the physics teacher

.

there is an animation that needs to be shown.


has encountered the same problem, has been solved, thank you!

Menu