我有以下代码,但缺少如何将我的 UIColor * 放入 gradient.colors 数组:
CAGradientLayer *gradient = [CAGradientLayer layer];
gradient.frame = self.view.frame;
UIColor *lightGreen = [UIColor colorWithRed:66.0f/255.0f green:79.0f/255.0f blue:91.0f/255.0f alpha:1.0f];
UIColor *darkGreen = [UIColor colorWithRed:66.0f/255.0f green:79.0f/255.0f blue:91.0f/255.0f alpha:1.0f];
gradient.colors = [NSArray arrayWithObjects:(id)[[UIColor lightGrayColor]CGColor], (id)[[UIColor darkGrayColor]CGColor], nil];
[self.view.layer addSublayer:gradient];