UILabel add GradientLayer [duplicate]
问题 This question already has answers here : Adding a CGGradient as sublayer to UILabel hides the text of label (4 answers) Closed 6 years ago . To add a background gradient to a UILabel I use the following code. Before using the gradient, UILabel Appears like this. Now, to add a gradient I use the following code. CAGradientLayer *gradLayer=[CAGradientLayer layer]; gradLayer.frame=self.myView.layer.bounds; [gradLayer setColors:[NSArray arrayWithObjects:(id)([UIColor redColor].CGColor), (id)(