如图:由于label1和label2在同一位置,这是在上层的label2颜色显示就会有偏差,正常应该是label3显示效果
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];
有个动画中需要都显示,已经解决了