IOS-viewController add gradient color

IOS-viewController add gradient color

Set the gradient background color CAGradientLayer *gradient = [CAGradientLayer layer]; gradient.frame [UIScreen = mainScreen].bounds; gradient.colors = [NSArray arrayWithObjects: (ID) [[UIColor blueColor] CGColor] (ID) [[UIColor greenColor] CGColor], nil] [self.view.layer insertSublayer:gradient atIndex:0];

Effect drawing:

IOS-viewController add gradient color